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


org.apache.commons.httpclient.HttpMethod

All known Subclasses:   org.apache.commons.httpclient.HttpMethodBase,
HttpMethod
public interface HttpMethod (Code)

HttpMethod interface represents a request to be sent via a HttpConnection HTTP connection and a corresponding response.


author:
   Remy Maucherat
author:
   Rod Waldhoff
author:
   Jeff Dever
author:
   Mike Bowler
author:
   Oleg Kalnichevski
version:
   $Revision: 480424 $ $Date: 2006-11-29 06:56:49 +0100 (Wed, 29 Nov 2006) $
since:
   1.0




Method Summary
 voidabort()
     Aborts the execution of the HTTP method.
 voidaddRequestHeader(String headerName, String headerValue)
     Adds the specified request header, not overwriting any previous value.
 voidaddRequestHeader(Header header)
     Adds the specified request header, not overwriting any previous value.
 voidaddResponseFooter(Header footer)
     Add a footer to this method's response.
 intexecute(HttpState state, HttpConnection connection)
     Executes this method using the specified HttpConnection and HttpState.
 booleangetDoAuthentication()
    
 booleangetFollowRedirects()
     Returns true if the HTTP method should automatically follow HTTP redirects (status code 302, etc.), false otherwise.
public  AuthStategetHostAuthState()
    
 HostConfigurationgetHostConfiguration()
     Gets the host configuration for this method.
 StringgetName()
     Obtains the name of the HTTP method as used in the HTTP request line, for example "GET" or "POST".
public  HttpMethodParamsgetParams()
     Returns HttpMethodParams HTTP protocol parameters associated with this method.
 StringgetPath()
     Returns the path of the HTTP method.
public  AuthStategetProxyAuthState()
    
 StringgetQueryString()
     Returns the query string of this HTTP method.
 HeadergetRequestHeader(String headerName)
     Gets the request header with the given name.
 Header[]getRequestHeaders()
     Returns the current request headers for this HTTP method.
 Header[]getRequestHeaders(String headerName)
     Returns the request headers with the given name.
 byte[]getResponseBody()
     Returns the response body of the HTTP method, if any, as an array of bytes. If the method has not yet been executed or the response has no body, null is returned.
 InputStreamgetResponseBodyAsStream()
     Returns the response body of the HTTP method, if any, as an InputStream. If the response had no body or the method has not yet been executed, null is returned.
 StringgetResponseBodyAsString()
     Returns the response body of the HTTP method, if any, as a String .
 HeadergetResponseFooter(String footerName)
     Return the specified response footer.
 Header[]getResponseFooters()
     Returns the response footers from the most recent execution of this request. an array containing the response footers in the order that theyappeared in the response.
 HeadergetResponseHeader(String headerName)
     Returns the specified response header.
 Header[]getResponseHeaders()
     Returns the response headers from the most recent execution of this request.
 Header[]getResponseHeaders(String headerName)
     Returns the response headers with the given name.
 intgetStatusCode()
     Returns the status code associated with the latest response.
 StatusLinegetStatusLine()
     Returns the Status-Line from the most recent response for this method, or null if the method has not been executed.
 StringgetStatusText()
     Returns the status text (or "reason phrase") associated with the latest response.
 URIgetURI()
     Returns the URI for this method.
 booleanhasBeenUsed()
     Returns true if the HTTP method has been already HttpMethod.execute executed , but not HttpMethod.recycle recycled .
 booleanisRequestSent()
     Returns true if the HTTP has been transmitted to the target server in its entirety, false otherwise.
 booleanisStrictMode()
     Returns the value of the strict mode flag.
 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.
 voidreleaseConnection()
     Releases the connection being used by this HTTP method.
 voidremoveRequestHeader(String headerName)
     Removes all request headers with the given name.
 voidremoveRequestHeader(Header header)
     Removes the given request header.
 voidsetDoAuthentication(boolean doAuthentication)
    
 voidsetFollowRedirects(boolean followRedirects)
    
public  voidsetParams(HttpMethodParams params)
     Assigns HttpMethodParams HTTP protocol parameters for this method.
 voidsetPath(String path)
     Sets the path of the HTTP method. It is responsibility of the caller to ensure that the path is properly encoded (URL safe).
Parameters:
  path - The path of the HTTP method.
 voidsetQueryString(String queryString)
     Sets the query string of the HTTP method. It is responsibility of the caller to ensure that the path is properly encoded (URL safe).
 voidsetQueryString(NameValuePair[] params)
     Sets the query string of this HTTP method.
 voidsetRequestHeader(String headerName, String headerValue)
     Sets the specified request header, overwriting any previous value.
 voidsetRequestHeader(Header header)
     Sets the specified request header, overwriting any previous value.
 voidsetStrictMode(boolean strictMode)
     Defines how strictly the method follows the HTTP protocol specification.
 voidsetURI(URI uri)
     Sets the URI for this method.
 booleanvalidate()
     Returns true the method is ready to execute, false otherwise.



Method Detail
abort
void abort()(Code)
Aborts the execution of the HTTP method.
See Also:   HttpMethod.execute(HttpState,HttpConnection)
since:
   3.0



addRequestHeader
void addRequestHeader(String headerName, String headerValue)(Code)
Adds the specified request header, not overwriting any previous value. If the same header is added multiple times, perhaps with different values, multiple instances of that header will be sent in the HTTP request. Note that header-name matching is case insensitive.
Parameters:
  headerName - the header's name
Parameters:
  headerValue - the header's value
See Also:   HttpMethod.addRequestHeader(Header)
See Also:   HttpMethod.getRequestHeader(String)
See Also:   HttpMethod.removeRequestHeader(String)



addRequestHeader
void addRequestHeader(Header header)(Code)
Adds the specified request header, not overwriting any previous value. If the same header is added multiple times, perhaps with different values, multiple instances of that header will be sent in the HTTP request. Note that header-name matching is case insensitive.
Parameters:
  header - the header
See Also:   HttpMethod.addRequestHeader(String,String)
See Also:   HttpMethod.getRequestHeader(String)
See Also:   HttpMethod.removeRequestHeader(String)



addResponseFooter
void addResponseFooter(Header footer)(Code)
Add a footer to this method's response.

Note: This method is for internal use only and should not be called by external clients.
Parameters:
  footer - the footer to add
since:
   2.0




execute
int execute(HttpState state, HttpConnection connection) throws HttpException, IOException(Code)
Executes this method using the specified HttpConnection and HttpState.
Parameters:
  state - the HttpState state information to associate with this method
Parameters:
  connection - 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. the integer status code if one was obtained, or -1



getDoAuthentication
boolean getDoAuthentication()(Code)
Returns true if the HTTP method should automatically handle HTTP authentication challenges (status code 401, etc.), false otherwise true if authentication challenges will be processed automatically, false otherwise.
since:
   2.0
See Also:   HttpMethod.setDoAuthentication(boolean)



getFollowRedirects
boolean getFollowRedirects()(Code)
Returns true if the HTTP method should automatically follow HTTP redirects (status code 302, etc.), false otherwise. true if the method will automatically follow HTTP redirects, false otherwise



getHostAuthState
public AuthState getHostAuthState()(Code)
Returns the target host AuthState authentication state host authentication state
since:
   3.0



getHostConfiguration
HostConfiguration getHostConfiguration()(Code)
Gets the host configuration for this method. The configuration specifies the server, port, protocol, and proxy server via which this method will send its HTTP request. the HostConfiguration or null if none is set



getName
String getName()(Code)
Obtains the name of the HTTP method as used in the HTTP request line, for example "GET" or "POST". the name of this method



getParams
public HttpMethodParams getParams()(Code)
Returns HttpMethodParams HTTP protocol parameters associated with this method.
since:
   3.0
See Also:   HttpMethodParams



getPath
String getPath()(Code)
Returns the path of the HTTP method. Calling this method after the request has been executed will return the actual path, following any redirects automatically handled by this HTTP method. the path of the HTTP method, in URL encoded form



getProxyAuthState
public AuthState getProxyAuthState()(Code)
Returns the proxy AuthState authentication state host authentication state
since:
   3.0



getQueryString
String getQueryString()(Code)
Returns the query string of this HTTP method. the query string in URL encoded form, without a leading '?'.
See Also:   HttpMethod.setQueryString(NameValuePair[])
See Also:   
See Also:   HttpMethod.setQueryString(String)



getRequestHeader
Header getRequestHeader(String headerName)(Code)
Gets the request header with the given name. If there are multiple headers with the same name, there values will be combined with the ',' separator as specified by RFC2616. Note that header-name matching is case insensitive.
Parameters:
  headerName - the header name the header



getRequestHeaders
Header[] getRequestHeaders()(Code)
Returns the current request headers for this HTTP method. The returned headers will be in the same order that they were added with addRequestHeader. If there are multiple request headers with the same name (e.g. Cookie), they will be returned as multiple entries in the array. an array containing all of the request headers
See Also:   HttpMethod.addRequestHeader(Header)
See Also:   HttpMethod.addRequestHeader(String,String)



getRequestHeaders
Header[] getRequestHeaders(String headerName)(Code)
Returns the request headers with the given name. Note that header-name matching is case insensitive.
Parameters:
  headerName - the name of the headers to be returned. an array of zero or more headers
since:
   3.0



getResponseBody
byte[] getResponseBody() throws IOException(Code)
Returns the response body of the HTTP method, if any, as an array of bytes. If the method has not yet been executed or the response has no body, null is returned. Note that this method does not propagate I/O exceptions. If an error occurs while reading the body, null will be returned. The response body, or null if thebody is not available.
throws:
  IOException - if an I/O (transport) problem occurs



getResponseBodyAsStream
InputStream getResponseBodyAsStream() throws IOException(Code)
Returns the response body of the HTTP method, if any, as an InputStream. If the response had no body or the method has not yet been executed, null is returned. Additionally, null may be returned if HttpMethod.releaseConnection has been called or if this method was called previously and the resulting stream was closed. The response body, or null if it is not available
throws:
  IOException - if an I/O (transport) problem occurs



getResponseBodyAsString
String getResponseBodyAsString() throws IOException(Code)
Returns the response body of the HTTP method, if any, as a String . If response body is not available or cannot be read, null is returned. The raw bytes in the body are converted to a String using the character encoding specified in the response's Content-Type header, or ISO-8859-1 if the response did not specify a character set.

Note that this method does not propagate I/O exceptions. If an error occurs while reading the body, null will be returned. The response body converted to a String, or nullif the body is not available.
throws:
  IOException - if an I/O (transport) problem occurs




getResponseFooter
Header getResponseFooter(String footerName)(Code)
Return the specified response footer. Note that footer-name matching is case insensitive.
Parameters:
  footerName - The name of the footer. The response footer.



getResponseFooters
Header[] getResponseFooters()(Code)
Returns the response footers from the most recent execution of this request. an array containing the response footers in the order that theyappeared in the response. If the response had no footers,an empty array will be returned.



getResponseHeader
Header getResponseHeader(String headerName)(Code)
Returns the specified response header. Note that header-name matching is case insensitive.
Parameters:
  headerName - The name of the header to be returned. The specified response header. If the repsonse contained multipleinstances of the header, its values will be combined using the ','separator as specified by RFC2616.



getResponseHeaders
Header[] getResponseHeaders()(Code)
Returns the response headers from the most recent execution of this request. A newly-created array containing all of the response headers, in the order in which they appeared in the response.



getResponseHeaders
Header[] getResponseHeaders(String headerName)(Code)
Returns the response headers with the given name. Note that header-name matching is case insensitive.
Parameters:
  headerName - the name of the headers to be returned. an array of zero or more headers
since:
   3.0



getStatusCode
int getStatusCode()(Code)
Returns the status code associated with the latest response. The status code from the most recent execution of this method.If the method has not yet been executed, the result is undefined.



getStatusLine
StatusLine getStatusLine()(Code)
Returns the Status-Line from the most recent response for this method, or null if the method has not been executed. the status line, or null if the method has not been executed
since:
   2.0



getStatusText
String getStatusText()(Code)
Returns the status text (or "reason phrase") associated with the latest response. The status text from the most recent execution of this method.If the method has not yet been executed, the result is undefined.



getURI
URI getURI() throws URIException(Code)
Returns the URI for this method. The URI will be absolute if the host configuration has been set and relative otherwise. the URI for this method
throws:
  URIException - if a URI cannot be constructed



hasBeenUsed
boolean hasBeenUsed()(Code)
Returns true if the HTTP method has been already HttpMethod.execute executed , but not HttpMethod.recycle recycled . true if the method has been executed, false otherwise



isRequestSent
boolean isRequestSent()(Code)
Returns true if the HTTP has been transmitted to the target server in its entirety, false otherwise. This flag can be useful for recovery logic. If the request has not been transmitted in its entirety, it is safe to retry the failed method. true if the request has been sent, false otherwise



isStrictMode
boolean isStrictMode()(Code)
Returns the value of the strict mode flag. true if strict mode is enabled, false otherwiseorg.apache.commons.httpclient.params.HttpParams.setParameter(StringObject)
See Also:   HttpMethod.setStrictMode(boolean)



recycle
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:   HttpMethod.releaseConnection()



releaseConnection
void releaseConnection()(Code)
Releases the connection being used by this HTTP method. In particular the connection is used to read the response (if there is one) and will be held until the response has been read. If the connection can be reused by other HTTP methods it is NOT closed at this point.

After this method is called, HttpMethod.getResponseBodyAsStream will return null, and HttpMethod.getResponseBody and HttpMethod.getResponseBodyAsString may return null.




removeRequestHeader
void removeRequestHeader(String headerName)(Code)
Removes all request headers with the given name. Note that header-name matching is case insensitive.
Parameters:
  headerName - the header name



removeRequestHeader
void removeRequestHeader(Header header)(Code)
Removes the given request header.
Parameters:
  header - the header
since:
   3.0



setDoAuthentication
void setDoAuthentication(boolean doAuthentication)(Code)
Sets whether or not the HTTP method should automatically handle HTTP authentication challenges (status code 401, etc.)
Parameters:
  doAuthentication - true to process authentication challengesautomatically, false otherwise.
since:
   2.0
See Also:   HttpMethod.getDoAuthentication()



setFollowRedirects
void setFollowRedirects(boolean followRedirects)(Code)
Sets whether or not the HTTP method should automatically follow HTTP redirects (status code 302, etc.)
Parameters:
  followRedirects - true if the method will automatically follow redirects,false otherwise.



setParams
public void setParams(HttpMethodParams params)(Code)
Assigns HttpMethodParams HTTP protocol parameters for this method.
since:
   3.0
See Also:   HttpMethodParams



setPath
void setPath(String path)(Code)
Sets the path of the HTTP method. It is responsibility of the caller to ensure that the path is properly encoded (URL safe).
Parameters:
  path - The path of the HTTP method. The path is expectedto be URL encoded.



setQueryString
void setQueryString(String queryString)(Code)
Sets the query string of the HTTP method. It is responsibility of the caller to ensure that the path is properly encoded (URL safe). The string must not include an initial '?' character.
Parameters:
  queryString - the query to be used in the request, with no leading '?' character
See Also:   HttpMethod.getQueryString()
See Also:   HttpMethod.setQueryString(NameValuePair[])



setQueryString
void setQueryString(NameValuePair[] params)(Code)
Sets the query string of this HTTP method. The pairs are encoded as UTF-8 characters. To use a different charset the parameters can be encoded manually using EncodingUtil and set as a single String.
Parameters:
  params - An array of NameValuePairs to use as the query string.The name/value pairs will be automatically URL encoded and should nothave been encoded previously.
See Also:   HttpMethod.getQueryString()
See Also:   HttpMethod.setQueryString(String)
See Also:   org.apache.commons.httpclient.util.EncodingUtil.formUrlEncode(NameValuePair[]String)



setRequestHeader
void setRequestHeader(String headerName, String headerValue)(Code)
Sets the specified request header, overwriting any previous value. Note that header-name matching is case insensitive.
Parameters:
  headerName - the header's name
Parameters:
  headerValue - the header's value
See Also:   HttpMethod.setRequestHeader(Header)
See Also:   HttpMethod.getRequestHeader(String)
See Also:   HttpMethod.removeRequestHeader(String)



setRequestHeader
void setRequestHeader(Header header)(Code)
Sets the specified request header, overwriting any previous value. Note that header-name matching is case insensitive.
Parameters:
  header - the header to be set
See Also:   HttpMethod.setRequestHeader(String,String)
See Also:   HttpMethod.getRequestHeader(String)
See Also:   HttpMethod.removeRequestHeader(String)



setStrictMode
void setStrictMode(boolean strictMode)(Code)
Defines how strictly the method follows the HTTP protocol specification. (See RFC 2616 and other relevant RFCs.) In the strict mode the method precisely implements the requirements of the specification, whereas in non-strict mode it attempts to mimic the exact behaviour of commonly used HTTP agents, which many HTTP servers expect.
Parameters:
  strictMode - true for strict mode, false otherwiseorg.apache.commons.httpclient.params.HttpParams.setParameter(StringObject)
See Also:   HttpMethod.isStrictMode()



setURI
void setURI(URI uri) throws URIException(Code)
Sets the URI for this method.
Parameters:
  uri - URI to be set
throws:
  URIException - if a URI cannot be set
since:
   3.0



validate
boolean validate()(Code)
Returns true the method is ready to execute, false otherwise. true if the method is ready to execute, false otherwise.



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