Java Doc for EntityEnclosingMethod.java in  » Net » Apache-common-HttpClient » org » apache » commons » httpclient » methods » 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 » Apache common HttpClient » org.apache.commons.httpclient.methods 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.httpclient.methods.ExpectContinueMethod
   org.apache.commons.httpclient.methods.EntityEnclosingMethod

All known Subclasses:   org.apache.commons.httpclient.methods.PostMethod,  org.apache.commons.httpclient.methods.PutMethod,
EntityEnclosingMethod
abstract public class EntityEnclosingMethod extends ExpectContinueMethod (Code)
This abstract class serves as a foundation for all HTTP methods that can enclose an entity within requests
author:
   Oleg Kalnichevski
author:
   Jeff Dever
since:
   2.0beta1
version:
   $Revision: 480424 $


Field Summary
final public static  longCONTENT_LENGTH_AUTO
     The content length will be calculated automatically.
final public static  longCONTENT_LENGTH_CHUNKED
     The request will use chunked transfer encoding.

Constructor Summary
public  EntityEnclosingMethod()
     No-arg constructor.
public  EntityEnclosingMethod(String uri)
     Constructor specifying a URI.

Method Summary
protected  voidaddContentLengthRequestHeader(HttpState state, HttpConnection conn)
     Generates Content-Length or Transfer-Encoding: Chunked request header, as long as no Content-Length request header already exists.
protected  voidaddRequestHeaders(HttpState state, HttpConnection conn)
     Populates the request headers map to with additional org.apache.commons.httpclient.Header headers to be submitted to the given HttpConnection .

This implementation adds tt>Content-Length or Transfer-Encoding headers.

Subclasses may want to override this method to to add additional headers, and may choose to invoke this implementation (via super) to add the "standard" headers.


Parameters:
  state - the HttpState state information associated with this method
Parameters:
  conn - the HttpConnection connection used to executethis HTTP method
throws:
  IOException - if an I/O (transport) error occurs.
protected  voidclearRequestBody()
     Clears the request body.
protected  byte[]generateRequestBody()
     Generates the request body.
protected  RequestEntitygenerateRequestEntity()
    
public  booleangetFollowRedirects()
     Entity enclosing requests cannot be redirected without user intervention according to RFC 2616.
public  StringgetRequestCharSet()
     Returns the request's charset.
protected  longgetRequestContentLength()
     Returns the length of the request body.
public  RequestEntitygetRequestEntity()
    
protected  booleanhasRequestContent()
     Returns true if there is a request body to be sent.
public  voidrecycle()
     Recycles the HTTP method so that it can be used again. Note that all of the instance variables will be reset once this method has been called.
public  voidsetContentChunked(boolean chunked)
     Sets whether or not the content should be chunked.
public  voidsetFollowRedirects(boolean followRedirects)
     Entity enclosing requests cannot be redirected without user intervention according to RFC 2616.
public  voidsetRequestBody(InputStream body)
     Sets the request body to be the specified inputstream.
public  voidsetRequestBody(String body)
     Sets the request body to be the specified string.
public  voidsetRequestContentLength(int length)
     Sets length information about the request body.

Note: If you specify a content length the request is unbuffered.

public  voidsetRequestContentLength(long length)
     Sets length information about the request body.

Note: If you specify a content length the request is unbuffered.

public  voidsetRequestEntity(RequestEntity requestEntity)
    
protected  booleanwriteRequestBody(HttpState state, HttpConnection conn)
     Writes the request body to the given HttpConnection connection .
Parameters:
  state - the HttpState state information associated with this method
Parameters:
  conn - the HttpConnection connection used to executethis HTTP method true
throws:
  IOException - if an I/O (transport) error occurs.

Field Detail
CONTENT_LENGTH_AUTO
final public static long CONTENT_LENGTH_AUTO(Code)
The content length will be calculated automatically. This implies buffering of the content. InputStreamRequestEntity.CONTENT_LENGTH_AUTO



CONTENT_LENGTH_CHUNKED
final public static long CONTENT_LENGTH_CHUNKED(Code)
The request will use chunked transfer encoding. Content length is not calculated and the content is not buffered.
EntityEnclosingMethod.setContentChunked(boolean)




Constructor Detail
EntityEnclosingMethod
public EntityEnclosingMethod()(Code)
No-arg constructor.
since:
   2.0



EntityEnclosingMethod
public EntityEnclosingMethod(String uri)(Code)
Constructor specifying a URI.
Parameters:
  uri - either an absolute or relative URI
since:
   2.0




Method Detail
addContentLengthRequestHeader
protected void addContentLengthRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException(Code)
Generates Content-Length or Transfer-Encoding: Chunked request header, as long as no Content-Length request header already exists.
Parameters:
  state - current state of http requests
Parameters:
  conn - the connection to use for I/O
throws:
  IOException - when errors occur reading or writing to/from theconnection
throws:
  HttpException - when a recoverable error occurs



addRequestHeaders
protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException(Code)
Populates the request headers map to with additional org.apache.commons.httpclient.Header headers to be submitted to the given HttpConnection .

This implementation adds tt>Content-Length or Transfer-Encoding headers.

Subclasses may want to override this method to to add additional headers, and may choose to invoke this implementation (via super) to add the "standard" headers.


Parameters:
  state - the HttpState state information associated with this method
Parameters:
  conn - the HttpConnection connection used to executethis HTTP method
throws:
  IOException - if an I/O (transport) error occurs. Some transport exceptionscan be recovered from.
throws:
  HttpException - if a protocol exception occurs. Usually protocol exceptions cannot be recovered from.
See Also:   EntityEnclosingMethod.writeRequestHeaders
since:
   3.0



clearRequestBody
protected void clearRequestBody()(Code)
Clears the request body.

This method must be overridden by sub-classes that implement alternative request content input methods.


since:
   2.0beta1



generateRequestBody
protected byte[] generateRequestBody()(Code)
Generates the request body.

This method must be overridden by sub-classes that implement alternative request content input methods.

request body as an array of bytes. If the request content has not been set, returns null.
since:
   2.0beta1



generateRequestEntity
protected RequestEntity generateRequestEntity()(Code)



getFollowRedirects
public boolean getFollowRedirects()(Code)
Entity enclosing requests cannot be redirected without user intervention according to RFC 2616. false.
since:
   2.0



getRequestCharSet
public String getRequestCharSet()(Code)
Returns the request's charset. The charset is parsed from the request entity's content type, unless the content type header has been set manually.
See Also:   RequestEntity.getContentType
since:
   3.0



getRequestContentLength
protected long getRequestContentLength()(Code)
Returns the length of the request body. number of bytes in the request body



getRequestEntity
public RequestEntity getRequestEntity()(Code)
Returns the requestEntity.
since:
   3.0



hasRequestContent
protected boolean hasRequestContent()(Code)
Returns true if there is a request body to be sent.

This method must be overridden by sub-classes that implement alternative request content input methods

boolean
since:
   2.0beta1



recycle
public void recycle()(Code)
Recycles the HTTP method so that it can be used again. Note that all of the instance variables will be reset once this method has been called. This method will also release the connection being used by this HTTP method.
See Also:   EntityEnclosingMethod.releaseConnection()



setContentChunked
public void setContentChunked(boolean chunked)(Code)
Sets whether or not the content should be chunked.
Parameters:
  chunked - true if the content should be chunked
since:
   3.0



setFollowRedirects
public void setFollowRedirects(boolean followRedirects)(Code)
Entity enclosing requests cannot be redirected without user intervention according to RFC 2616.
Parameters:
  followRedirects - must always be false



setRequestBody
public void setRequestBody(InputStream body)(Code)
Sets the request body to be the specified inputstream.
Parameters:
  body - Request body content as java.io.InputStreamEntityEnclosingMethod.setRequestEntity(RequestEntity)



setRequestBody
public void setRequestBody(String body)(Code)
Sets the request body to be the specified string. The string will be submitted, using the encoding specified in the Content-Type request header.
Example: setRequestHeader("Content-type", "text/xml; charset=UTF-8");
Would use the UTF-8 encoding. If no charset is specified, the org.apache.commons.httpclient.HttpConstants.DEFAULT_CONTENT_CHARSET default content encoding is used (ISO-8859-1).
Parameters:
  body - Request body content as a stringEntityEnclosingMethod.setRequestEntity(RequestEntity)



setRequestContentLength
public void setRequestContentLength(int length)(Code)
Sets length information about the request body.

Note: If you specify a content length the request is unbuffered. This prevents redirection and automatic retry if a request fails the first time. This means that the HttpClient can not perform authorization automatically but will throw an Exception. You will have to set the necessary 'Authorization' or 'Proxy-Authorization' headers manually.


Parameters:
  length - size in bytes or any of CONTENT_LENGTH_AUTO,CONTENT_LENGTH_CHUNKED. If number of bytes or CONTENT_LENGTH_CHUNKEDis specified the content will not be buffered internally and theContent-Length header of the request will be used. In this casethe user is responsible to supply the correct content length.If CONTENT_LENGTH_AUTO is specified the request will be bufferedbefore it is sent over the network.EntityEnclosingMethod.setContentChunked(boolean)EntityEnclosingMethod.setRequestEntity(RequestEntity)



setRequestContentLength
public void setRequestContentLength(long length)(Code)
Sets length information about the request body.

Note: If you specify a content length the request is unbuffered. This prevents redirection and automatic retry if a request fails the first time. This means that the HttpClient can not perform authorization automatically but will throw an Exception. You will have to set the necessary 'Authorization' or 'Proxy-Authorization' headers manually.


Parameters:
  length - size in bytes or any of CONTENT_LENGTH_AUTO,CONTENT_LENGTH_CHUNKED. If number of bytes or CONTENT_LENGTH_CHUNKEDis specified the content will not be buffered internally and theContent-Length header of the request will be used. In this casethe user is responsible to supply the correct content length.If CONTENT_LENGTH_AUTO is specified the request will be bufferedbefore it is sent over the network.EntityEnclosingMethod.setContentChunked(boolean)EntityEnclosingMethod.setRequestEntity(RequestEntity)



setRequestEntity
public void setRequestEntity(RequestEntity requestEntity)(Code)

Parameters:
  requestEntity - The requestEntity to set.
since:
   3.0



writeRequestBody
protected boolean writeRequestBody(HttpState state, HttpConnection conn) throws IOException, HttpException(Code)
Writes the request body to the given HttpConnection connection .
Parameters:
  state - the HttpState state information associated with this method
Parameters:
  conn - the HttpConnection connection used to executethis HTTP method true
throws:
  IOException - if an I/O (transport) error occurs. Some transport exceptionscan be recovered from.
throws:
  HttpException - if a protocol exception occurs. Usually protocol exceptions cannot be recovered from.



Methods inherited from org.apache.commons.httpclient.methods.ExpectContinueMethod
protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException(Code)(Java Doc)
public boolean getUseExpectHeader()(Code)(Java Doc)
abstract protected boolean hasRequestContent()(Code)(Java Doc)
public void setUseExpectHeader(boolean value)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.