Source Code Cross Referenced for BasicNameValuePair.java in  » Net » httpcomponents-core-4.0-beta1 » org » apache » http » message » 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 » Net » httpcomponents core 4.0 beta1 » org.apache.http.message 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $HeadURL: https://svn.apache.org/repos/asf/httpcomponents/httpcore/tags/4.0-beta1/module-main/src/main/java/org/apache/http/message/BasicNameValuePair.java $
003:         * $Revision: 604625 $
004:         * $Date: 2007-12-16 15:11:11 +0100 (Sun, 16 Dec 2007) $
005:         *
006:         * ====================================================================
007:         * Licensed to the Apache Software Foundation (ASF) under one
008:         * or more contributor license agreements.  See the NOTICE file
009:         * distributed with this work for additional information
010:         * regarding copyright ownership.  The ASF licenses this file
011:         * to you under the Apache License, Version 2.0 (the
012:         * "License"); you may not use this file except in compliance
013:         * with the License.  You may obtain a copy of the License at
014:         *
015:         *   http://www.apache.org/licenses/LICENSE-2.0
016:         *
017:         * Unless required by applicable law or agreed to in writing,
018:         * software distributed under the License is distributed on an
019:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
020:         * KIND, either express or implied.  See the License for the
021:         * specific language governing permissions and limitations
022:         * under the License.
023:         * ====================================================================
024:         *
025:         * This software consists of voluntary contributions made by many
026:         * individuals on behalf of the Apache Software Foundation.  For more
027:         * information on the Apache Software Foundation, please see
028:         * <http://www.apache.org/>.
029:         *
030:         */
031:
032:        package org.apache.http.message;
033:
034:        import org.apache.http.NameValuePair;
035:        import org.apache.http.util.CharArrayBuffer;
036:        import org.apache.http.util.LangUtils;
037:
038:        /**
039:         * A simple class encapsulating an attribute/value pair.
040:         * <p>
041:         *  This class comforms to the generic grammar and formatting rules outlined in the 
042:         *  <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2">Section 2.2</a>
043:         *  and  
044:         *  <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6">Section 3.6</a>
045:         *  of <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.txt">RFC 2616</a>
046:         * </p>
047:         * <h>2.2 Basic Rules</h>
048:         * <p>
049:         *  The following rules are used throughout this specification to describe basic parsing constructs. 
050:         *  The US-ASCII coded character set is defined by ANSI X3.4-1986.
051:         * </p>
052:         * <pre>
053:         *     OCTET          = <any 8-bit sequence of data>
054:         *     CHAR           = <any US-ASCII character (octets 0 - 127)>
055:         *     UPALPHA        = <any US-ASCII uppercase letter "A".."Z">
056:         *     LOALPHA        = <any US-ASCII lowercase letter "a".."z">
057:         *     ALPHA          = UPALPHA | LOALPHA
058:         *     DIGIT          = <any US-ASCII digit "0".."9">
059:         *     CTL            = <any US-ASCII control character
060:         *                      (octets 0 - 31) and DEL (127)>
061:         *     CR             = <US-ASCII CR, carriage return (13)>
062:         *     LF             = <US-ASCII LF, linefeed (10)>
063:         *     SP             = <US-ASCII SP, space (32)>
064:         *     HT             = <US-ASCII HT, horizontal-tab (9)>
065:         *     <">            = <US-ASCII double-quote mark (34)>
066:         * </pre>
067:         * <p>
068:         *  Many HTTP/1.1 header field values consist of words separated by LWS or special 
069:         *  characters. These special characters MUST be in a quoted string to be used within 
070:         *  a parameter value (as defined in section 3.6).
071:         * <p>
072:         * <pre>
073:         * token          = 1*<any CHAR except CTLs or separators>
074:         * separators     = "(" | ")" | "<" | ">" | "@"
075:         *                | "," | ";" | ":" | "\" | <">
076:         *                | "/" | "[" | "]" | "?" | "="
077:         *                | "{" | "}" | SP | HT
078:         * </pre>
079:         * <p>
080:         *  A string of text is parsed as a single word if it is quoted using double-quote marks.
081:         * </p>
082:         * <pre>
083:         * quoted-string  = ( <"> *(qdtext | quoted-pair ) <"> )
084:         * qdtext         = <any TEXT except <">>
085:         * </pre>
086:         * <p>
087:         *  The backslash character ("\") MAY be used as a single-character quoting mechanism only 
088:         *  within quoted-string and comment constructs.
089:         * </p>
090:         * <pre>
091:         * quoted-pair    = "\" CHAR
092:         * </pre>
093:         * <h>3.6 Transfer Codings</h>
094:         * <p>
095:         *  Parameters are in the form of attribute/value pairs.
096:         * </p>
097:         * <pre>
098:         * parameter               = attribute "=" value
099:         * attribute               = token
100:         * value                   = token | quoted-string
101:         * </pre> 
102:         * 
103:         * @author <a href="mailto:oleg at ural.com">Oleg Kalnichevski</a>
104:         * 
105:         */
106:        public class BasicNameValuePair implements  NameValuePair, Cloneable {
107:
108:            private final String name;
109:            private final String value;
110:
111:            /**
112:             * Default Constructor taking a name and a value. The value may be null.
113:             * 
114:             * @param name The name.
115:             * @param value The value.
116:             */
117:            public BasicNameValuePair(final String name, final String value) {
118:                super ();
119:                if (name == null) {
120:                    throw new IllegalArgumentException("Name may not be null");
121:                }
122:                this .name = name;
123:                this .value = value;
124:            }
125:
126:            /**
127:             * Returns the name.
128:             *
129:             * @return String name The name
130:             */
131:            public String getName() {
132:                return this .name;
133:            }
134:
135:            /**
136:             * Returns the value.
137:             *
138:             * @return String value The current value.
139:             */
140:            public String getValue() {
141:                return this .value;
142:            }
143:
144:            /**
145:             * Get a string representation of this pair.
146:             * 
147:             * @return A string representation.
148:             */
149:            public String toString() {
150:                // don't call complex default formatting for a simple toString
151:
152:                int len = this .name.length();
153:                if (this .value != null)
154:                    len += 1 + this .value.length();
155:                CharArrayBuffer buffer = new CharArrayBuffer(len);
156:
157:                buffer.append(this .name);
158:                if (this .value != null) {
159:                    buffer.append("=");
160:                    buffer.append(this .value);
161:                }
162:                return buffer.toString();
163:            }
164:
165:            public boolean equals(final Object object) {
166:                if (object == null)
167:                    return false;
168:                if (this  == object)
169:                    return true;
170:                if (object instanceof  NameValuePair) {
171:                    BasicNameValuePair that = (BasicNameValuePair) object;
172:                    return this .name.equals(that.name)
173:                            && LangUtils.equals(this .value, that.value);
174:                } else {
175:                    return false;
176:                }
177:            }
178:
179:            public int hashCode() {
180:                int hash = LangUtils.HASH_SEED;
181:                hash = LangUtils.hashCode(hash, this .name);
182:                hash = LangUtils.hashCode(hash, this .value);
183:                return hash;
184:            }
185:
186:            public Object clone() throws CloneNotSupportedException {
187:                return super.clone();
188:            }
189:
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.