1 /* HTTPCookie.java created March 3rd 2008
2 * Copyright (c) 2007-2009 Mathew McBride / "BionicMessage.net"
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 package net
.bionicmessage
.groupdav
;
28 public class HTTPCookie
{
29 protected String name
= null;
30 protected String value
= null;
34 public HTTPCookie(String cookieName
, String cookieValue
) {
35 this.name
= cookieName
;
36 this.value
= cookieValue
;
38 public HTTPCookie(String cookieString
) {
39 String
[] split
= cookieString
.split("=");
40 this.name
= split
[0].trim();
41 String cookieValue
= split
[1].trim();
42 if (cookieValue
.contains(";")) {
43 cookieValue
= cookieValue
.substring(0,cookieValue
.indexOf(';'));
45 this.value
= cookieValue
;
48 public String
getName() {
52 public String
getValue() {
55 public String
getCookieString() {
56 String cookieString
= String
.format("%s=%s;", this.name
, this.value
);