Source Code Cross Referenced for BasicHeader.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/BasicHeader.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.Header;
035:        import org.apache.http.HeaderElement;
036:        import org.apache.http.ParseException;
037:
038:        /**
039:         * Represents an HTTP header field.
040:         * 
041:         * <p>The HTTP header fields follow the same generic format as
042:         * that given in Section 3.1 of RFC 822. Each header field consists
043:         * of a name followed by a colon (":") and the field value. Field names
044:         * are case-insensitive. The field value MAY be preceded by any amount
045:         * of LWS, though a single SP is preferred. 
046:         *
047:         *<pre>
048:         *     message-header = field-name ":" [ field-value ]
049:         *     field-name     = token
050:         *     field-value    = *( field-content | LWS )
051:         *     field-content  = &lt;the OCTETs making up the field-value
052:         *                      and consisting of either *TEXT or combinations
053:         *                      of token, separators, and quoted-string&gt;
054:         *</pre>
055:         * 
056:         * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
057:         * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
058:         * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
059:         *
060:         *
061:         * <!-- empty lines above to avoid 'svn diff' context problems -->
062:         * @version $Revision: 604625 $ $Date: 2007-12-16 15:11:11 +0100 (Sun, 16 Dec 2007) $
063:         * 
064:         * @since 4.0
065:         */
066:        public class BasicHeader implements  Header, Cloneable {
067:
068:            /**
069:             * Header name.
070:             */
071:            private final String name;
072:
073:            /**
074:             * Header value.
075:             */
076:            private final String value;
077:
078:            /**
079:             * Constructor with name and value
080:             *
081:             * @param name the header name
082:             * @param value the header value
083:             */
084:            public BasicHeader(final String name, final String value) {
085:                super ();
086:                if (name == null) {
087:                    throw new IllegalArgumentException("Name may not be null");
088:                }
089:                this .name = name;
090:                this .value = value;
091:            }
092:
093:            /**
094:             * Returns the header name.
095:             *
096:             * @return String name The name
097:             */
098:            public String getName() {
099:                return this .name;
100:            }
101:
102:            /**
103:             * Returns the header value.
104:             *
105:             * @return String value The current value.
106:             */
107:            public String getValue() {
108:                return this .value;
109:            }
110:
111:            /**
112:             * Returns a {@link String} representation of the header.
113:             *
114:             * @return a string
115:             */
116:            public String toString() {
117:                // no need for non-default formatting in toString()
118:                return BasicLineFormatter.DEFAULT.formatHeader(null, this )
119:                        .toString();
120:            }
121:
122:            /**
123:             * Returns an array of {@link HeaderElement}s constructed from my value.
124:             *
125:             * @see BasicHeaderValueParser#parseElements
126:             * 
127:             * @return an array of header elements
128:             *
129:             * @throws ParseException   in case of a parse error
130:             */
131:            public HeaderElement[] getElements() throws ParseException {
132:                if (this .value != null) {
133:                    // result intentionally not cached, it's probably not used again
134:                    return BasicHeaderValueParser.parseElements(this .value,
135:                            null);
136:                } else {
137:                    return new HeaderElement[] {};
138:                }
139:            }
140:
141:            public Object clone() throws CloneNotSupportedException {
142:                return super.clone();
143:            }
144:
145:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.