View Javadoc

1   // ========================================================================
2   // Copyright (c) 2008-2009 Mort Bay Consulting Pty. Ltd.
3   // ------------------------------------------------------------------------
4   // All rights reserved. This program and the accompanying materials
5   // are made available under the terms of the Eclipse Public License v1.0
6   // and Apache License v2.0 which accompanies this distribution.
7   // The Eclipse Public License is available at 
8   // http://www.eclipse.org/legal/epl-v10.html
9   // The Apache License v2.0 is available at
10  // http://www.opensource.org/licenses/apache2.0.php
11  // You may elect to redistribute this code under either of these licenses. 
12  // ========================================================================
13  
14  package org.eclipse.jetty.http;
15  
16  public class HttpCookie
17  {
18      private final String _name;        
19      private final String _value;     
20      private final String _comment;                               
21      private final String _domain;    
22      private final int _maxAge;  
23      private final String _path;       
24      private final boolean _secure;   
25      private final int _version;   
26      private final boolean _httpOnly;
27  
28      /* ------------------------------------------------------------ */
29      public HttpCookie(String name, String value)
30      {
31          super();
32          _name = name;
33          _value = value;
34          _comment = null;
35          _domain = null;
36          _httpOnly = false;
37          _maxAge = -1;
38          _path = null;
39          _secure = false;
40          _version = 0;
41      }
42      
43      /* ------------------------------------------------------------ */
44      public HttpCookie(String name, String value, String domain, String path)
45      {
46          super();
47          _name = name;
48          _value = value;
49          _comment = null;
50          _domain = domain;
51          _httpOnly = false;
52          _maxAge = -1;
53          _path = path;
54          _secure = false;
55          _version = 0;
56          
57      }
58      
59      /* ------------------------------------------------------------ */
60      public HttpCookie(String name, String value, int maxAge)
61      {
62          super();
63          _name = name;
64          _value = value;
65          _comment = null;
66          _domain = null;
67          _httpOnly = false;
68          _maxAge = maxAge;
69          _path = null;
70          _secure = false;
71          _version = 0;
72      }
73      
74      /* ------------------------------------------------------------ */
75      public HttpCookie(String name, String value, String domain, String path, int maxAge, boolean httpOnly, boolean secure)
76      {
77          super();
78          _comment = null;
79          _domain = domain;
80          _httpOnly = httpOnly;
81          _maxAge = maxAge;
82          _name = name;
83          _path = path;
84          _secure = secure;
85          _value = value;
86          _version = 0;
87      }
88      
89      /* ------------------------------------------------------------ */
90      public HttpCookie(String name, String value, String domain, String path, int maxAge, boolean httpOnly, boolean secure, String comment, int version)
91      {
92          super();
93          _comment = comment;
94          _domain = domain;
95          _httpOnly = httpOnly;
96          _maxAge = maxAge;
97          _name = name;
98          _path = path;
99          _secure = secure;
100         _value = value;
101         _version = version;
102     }
103     
104     /* ------------------------------------------------------------ */
105     /** Get the name.
106      * @return the name
107      */
108     public String getName()
109     {
110         return _name;
111     }
112     
113     /* ------------------------------------------------------------ */
114     /** Get the value.
115      * @return the value
116      */
117     public String getValue()
118     {
119         return _value;
120     }
121     
122     /* ------------------------------------------------------------ */
123     /** Get the comment.
124      * @return the comment
125      */
126     public String getComment()
127     {
128         return _comment;
129     }
130     
131     /* ------------------------------------------------------------ */
132     /** Get the domain.
133      * @return the domain
134      */
135     public String getDomain()
136     {
137         return _domain;
138     }
139     
140     /* ------------------------------------------------------------ */
141     /** Get the maxAge.
142      * @return the maxAge
143      */
144     public int getMaxAge()
145     {
146         return _maxAge;
147     }
148     
149     /* ------------------------------------------------------------ */
150     /** Get the path.
151      * @return the path
152      */
153     public String getPath()
154     {
155         return _path;
156     }
157     
158     /* ------------------------------------------------------------ */
159     /** Get the secure.
160      * @return the secure
161      */
162     public boolean isSecure()
163     {
164         return _secure;
165     }
166     
167     /* ------------------------------------------------------------ */
168     /** Get the version.
169      * @return the version
170      */
171     public int getVersion()
172     {
173         return _version;
174     }
175     
176     /* ------------------------------------------------------------ */
177     /** Get the isHttpOnly.
178      * @return the isHttpOnly
179      */
180     public boolean isHttpOnly()
181     {
182         return _httpOnly;
183     }
184     
185     
186 }