View Javadoc

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