Source Code Cross Referenced for AbstractHttpEntity.java in  » Net » httpcomponents-core-4.0-beta1 » org » apache » http » entity » 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.entity 
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/entity/AbstractHttpEntity.java $
003:         * $Revision: 496070 $
004:         * $Date: 2007-01-14 13:18:34 +0100 (Sun, 14 Jan 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.entity;
033:
034:        import java.io.IOException;
035:
036:        import org.apache.http.Header;
037:        import org.apache.http.HttpEntity;
038:        import org.apache.http.message.BasicHeader;
039:        import org.apache.http.protocol.HTTP;
040:
041:        /**
042:         * Abstract base class for entities.
043:         * Provides the commonly used attributes for streamed and self-contained
044:         * implementations of {@link HttpEntity HttpEntity}.
045:         *
046:         * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
047:         *
048:         * @version $Revision: 496070 $
049:         * 
050:         * @since 4.0
051:         */
052:        public abstract class AbstractHttpEntity implements  HttpEntity {
053:
054:            /**
055:             * The Content-Type header.
056:             * Returned by {@link #getContentType getContentType},
057:             * unless that method is overridden.
058:             */
059:            protected Header contentType;
060:
061:            /**
062:             * The Content-Encoding header.
063:             * Returned by {@link #getContentEncoding getContentEncoding},
064:             * unless that method is overridden.
065:             */
066:            protected Header contentEncoding;
067:
068:            /**
069:             * The 'chunked' flag.
070:             * Returned by {@link #isChunked isChunked},
071:             * unless that method is overridden.
072:             */
073:            protected boolean chunked;
074:
075:            /**
076:             * Protected default constructor.
077:             * The attributes of the created object remain
078:             * <code>null</code> and <code>false</code>, respectively.
079:             */
080:            protected AbstractHttpEntity() {
081:                super ();
082:            }
083:
084:            /**
085:             * Obtains the Content-Type header.
086:             * The default implementation returns the value of the
087:             * {@link #contentType contentType} attribute.
088:             *
089:             * @return  the Content-Type header, or <code>null</code>
090:             */
091:            public Header getContentType() {
092:                return this .contentType;
093:            }
094:
095:            /**
096:             * Obtains the Content-Encoding header.
097:             * The default implementation returns the value of the
098:             * {@link #contentEncoding contentEncoding} attribute.
099:             *
100:             * @return  the Content-Encoding header, or <code>null</code>
101:             */
102:            public Header getContentEncoding() {
103:                return this .contentEncoding;
104:            }
105:
106:            /**
107:             * Obtains the 'chunked' flag.
108:             * The default implementation returns the value of the
109:             * {@link #chunked chunked} attribute.
110:             *
111:             * @return  the 'chunked' flag
112:             */
113:            public boolean isChunked() {
114:                return this .chunked;
115:            }
116:
117:            /**
118:             * Specifies the Content-Type header.
119:             * The default implementation sets the value of the
120:             * {@link #contentType contentType} attribute.
121:             *
122:             * @param contentType       the new Content-Encoding header, or
123:             *                          <code>null</code> to unset
124:             */
125:            public void setContentType(final Header contentType) {
126:                this .contentType = contentType;
127:            }
128:
129:            /**
130:             * Specifies the Content-Type header, as a string.
131:             * The default implementation calls
132:             * {@link #setContentType(Header) setContentType(Header)}.
133:             *
134:             * @param ctString     the new Content-Type header, or
135:             *                     <code>null</code> to unset
136:             */
137:            public void setContentType(final String ctString) {
138:                Header h = null;
139:                if (ctString != null) {
140:                    h = new BasicHeader(HTTP.CONTENT_TYPE, ctString);
141:                }
142:                setContentType(h);
143:            }
144:
145:            /**
146:             * Specifies the Content-Encoding header.
147:             * The default implementation sets the value of the
148:             * {@link #contentEncoding contentEncoding} attribute.
149:             *
150:             * @param contentEncoding   the new Content-Encoding header, or
151:             *                          <code>null</code> to unset
152:             */
153:            public void setContentEncoding(final Header contentEncoding) {
154:                this .contentEncoding = contentEncoding;
155:            }
156:
157:            /**
158:             * Specifies the Content-Encoding header, as a string.
159:             * The default implementation calls
160:             * {@link #setContentEncoding(Header) setContentEncoding(Header)}.
161:             *
162:             * @param ceString     the new Content-Encoding header, or
163:             *                     <code>null</code> to unset
164:             */
165:            public void setContentEncoding(final String ceString) {
166:                Header h = null;
167:                if (ceString != null) {
168:                    h = new BasicHeader(HTTP.CONTENT_ENCODING, ceString);
169:                }
170:                setContentEncoding(h);
171:            }
172:
173:            /**
174:             * Specifies the 'chunked' flag.
175:             * The default implementation sets the value of the
176:             * {@link #chunked chunked} attribute.
177:             *
178:             * @param b         the new 'chunked' flag
179:             */
180:            public void setChunked(boolean b) {
181:                this .chunked = b;
182:            }
183:
184:            /**
185:             * Does not consume anything.
186:             * The default implementation does nothing if
187:             * {@link HttpEntity#isStreaming isStreaming}
188:             * returns <code>false</code>, and throws an exception
189:             * if it returns <code>true</code>.
190:             * This removes the burden of implementing
191:             * an empty method for non-streaming entities.
192:             *
193:             * @throws IOException      in case of an I/O problem
194:             * @throws UnsupportedOperationException
195:             *          if a streaming subclass does not override this method
196:             */
197:            public void consumeContent() throws IOException,
198:                    UnsupportedOperationException {
199:                if (isStreaming()) {
200:                    throw new UnsupportedOperationException(
201:                            "streaming entity does not implement consumeContent()");
202:                }
203:            } // consumeContent
204:
205:        } // class AbstractHttpEntity
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.