Source Code Cross Referenced for Cookie.java in  » Web-Services » restlet-1.0.8 » org » restlet » data » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Services » restlet 1.0.8 » org.restlet.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 Noelios Consulting.
003:         * 
004:         * The contents of this file are subject to the terms of the Common Development
005:         * and Distribution License (the "License"). You may not use this file except in
006:         * compliance with the License.
007:         * 
008:         * You can obtain a copy of the license at
009:         * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
010:         * language governing permissions and limitations under the License.
011:         * 
012:         * When distributing Covered Code, include this CDDL HEADER in each file and
013:         * include the License file at http://www.opensource.org/licenses/cddl1.txt If
014:         * applicable, add the following below this CDDL HEADER, with the fields
015:         * enclosed by brackets "[]" replaced with your own identifying information:
016:         * Portions Copyright [yyyy] [name of copyright owner]
017:         */
018:
019:        package org.restlet.data;
020:
021:        import org.restlet.util.Engine;
022:
023:        /**
024:         * Cookie provided by a client.
025:         * 
026:         * @author Jerome Louvel (contact@noelios.com)
027:         */
028:        public class Cookie extends Parameter {
029:            /** The version number. */
030:            private int version;
031:
032:            /** The validity path. */
033:            private String path;
034:
035:            /** The domain name. */
036:            private String domain;
037:
038:            /**
039:             * Constructor.
040:             */
041:            public Cookie() {
042:                this (0, null, null, null, null);
043:            }
044:
045:            /**
046:             * Constructor.
047:             * 
048:             * @param version
049:             *            The version number.
050:             * @param name
051:             *            The name.
052:             * @param value
053:             *            The value.
054:             */
055:            public Cookie(int version, String name, String value) {
056:                this (version, name, value, null, null);
057:            }
058:
059:            /**
060:             * Constructor.
061:             * 
062:             * @param version
063:             *            The version number.
064:             * @param name
065:             *            The name.
066:             * @param value
067:             *            The value.
068:             * @param path
069:             *            The validity path.
070:             * @param domain
071:             *            The domain name.
072:             */
073:            public Cookie(int version, String name, String value, String path,
074:                    String domain) {
075:                super (name, value);
076:                this .version = version;
077:                this .path = path;
078:                this .domain = domain;
079:            }
080:
081:            /**
082:             * Constructor.
083:             * 
084:             * @param name
085:             *            The name.
086:             * @param value
087:             *            The value.
088:             */
089:            public Cookie(String name, String value) {
090:                this (0, name, value, null, null);
091:            }
092:
093:            /** {@inheritDoc} */
094:            @Override
095:            public boolean equals(Object obj) {
096:                boolean result = (obj == this );
097:
098:                // if obj == this no need to go further
099:                if (!result) {
100:                    // test for equality at Parameter level i.e. name and value.
101:                    if (super .equals(obj)) {
102:                        // if obj isn't a cookie or is null don't evaluate further
103:                        if ((obj instanceof  Cookie) && obj != null) {
104:                            Cookie that = (Cookie) obj;
105:                            result = (this .version == that.version);
106:                            if (result) // if versions are equal test domains
107:                            {
108:                                if (!(this .domain == null)) // compare domains
109:                                // taking care of nulls
110:                                {
111:                                    result = (this .domain.equals(that.domain));
112:                                } else {
113:                                    result = (that.domain == null);
114:                                }
115:
116:                                if (result) // if domains are equal test the paths
117:                                {
118:                                    if (!(this .path == null)) // compare paths taking
119:                                    // care of nulls
120:                                    {
121:                                        result = (this .path.equals(that.path));
122:                                    } else {
123:                                        result = (that.path == null);
124:                                    }
125:                                }
126:                            }
127:                        }
128:                    }
129:                }
130:
131:                return result;
132:            }
133:
134:            /**
135:             * Returns the domain name.
136:             * 
137:             * @return The domain name.
138:             */
139:            public String getDomain() {
140:                return this .domain;
141:            }
142:
143:            /**
144:             * Returns the validity path.
145:             * 
146:             * @return The validity path.
147:             */
148:            public String getPath() {
149:                return this .path;
150:            }
151:
152:            /**
153:             * Returns the cookie specification version.
154:             * 
155:             * @return The cookie specification version.
156:             */
157:            public int getVersion() {
158:                return this .version;
159:            }
160:
161:            /** {@inheritDoc} */
162:            @Override
163:            public int hashCode() {
164:                return Engine.hashCode(super .hashCode(), getVersion(),
165:                        getPath(), getDomain());
166:            }
167:
168:            /**
169:             * Sets the domain name.
170:             * 
171:             * @param domain
172:             *            The domain name.
173:             */
174:            public void setDomain(String domain) {
175:                this .domain = domain;
176:            }
177:
178:            /**
179:             * Sets the validity path.
180:             * 
181:             * @param path
182:             *            The validity path.
183:             */
184:            public void setPath(String path) {
185:                this .path = path;
186:            }
187:
188:            /**
189:             * Sets the cookie specification version.
190:             * 
191:             * @param version
192:             *            The cookie specification version.
193:             */
194:            public void setVersion(int version) {
195:                this.version = version;
196:            }
197:
198:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.