public class ApacheHTTPClient extends AbstractHTTPClient
HTTPClient.HTTPMethod
Constructor and Description |
---|
ApacheHTTPClient()
This is the default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
appendBaseURL(StringBuilder buffer,
String resource,
HTTPClientConfiguration configuration)
This function appends the base URL (protocol, host, port and resource) to the provided buffer.
|
protected void |
appendParameters(StringBuilder buffer,
String parameters)
This function appends the parameters text to the base URL.
|
protected org.apache.commons.httpclient.methods.RequestEntity |
createBinaryRequestContent(HTTPRequest httpRequest)
This function creates a binary type request entity and populates it with the data from the provided HTTP request.
|
protected org.apache.commons.httpclient.HttpClient |
createHttpClient()
This function creates and returns a new HTTP client.
|
protected HTTPResponse |
createHTTPResponse(int statusCode,
String responseContent)
This function creates and returns the HTTP response object.
|
protected org.apache.commons.httpclient.HttpMethodBase |
createMethod(String url,
HTTPClient.HTTPMethod httpMethod)
This function creates and returns a new HTTP method.
|
protected org.apache.commons.httpclient.methods.RequestEntity |
createMultiPartRequestContent(HTTPRequest httpRequest,
org.apache.commons.httpclient.HttpMethodBase httpMethodClient)
This function creates a multi part type request entity and populates it with the data from the provided HTTP
request.
|
protected org.apache.commons.httpclient.methods.RequestEntity |
createStringRequestContent(HTTPRequest httpRequest)
This function creates a string type request entity and populates it with the data from the provided HTTP request.
|
protected String |
createURL(HTTPRequest httpRequest,
HTTPClientConfiguration configuration)
This function creates the full URL from the provided values.
|
protected void |
setRequestContent(HTTPRequest httpRequest,
org.apache.commons.httpclient.HttpMethodBase httpMethodClient)
This function sets the request content.
|
protected void |
setupHTTPRequestHeaderProperties(HTTPRequest httpRequest,
org.apache.commons.httpclient.HttpMethodBase httpMethodClient)
This function sets the header properties in the HTTP method.
|
HTTPResponse |
submitHTTPRequest(HTTPRequest httpRequest,
HTTPClientConfiguration httpClientConfiguration,
HTTPClient.HTTPMethod httpMethod)
Submits the HTTP request and returns the HTTP response.
|
createHTTPClientConfiguration, getProvider
protected org.apache.commons.httpclient.HttpClient createHttpClient()
protected org.apache.commons.httpclient.HttpMethodBase createMethod(String url, HTTPClient.HTTPMethod httpMethod)
url
- The target URLhttpMethod
- The HTTP method to useprotected HTTPResponse createHTTPResponse(int statusCode, String responseContent)
statusCode
- The HTTP response status coderesponseContent
- The response content as stringprotected void appendBaseURL(StringBuilder buffer, String resource, HTTPClientConfiguration configuration)
buffer
- The buffer to updateresource
- The HTTP resourceconfiguration
- The HTTP configurationprotected void appendParameters(StringBuilder buffer, String parameters)
buffer
- The buffer to updateparameters
- The parameters lineprotected String createURL(HTTPRequest httpRequest, HTTPClientConfiguration configuration)
httpRequest
- The HTTP request to sendconfiguration
- HTTP client configurationprotected void setupHTTPRequestHeaderProperties(HTTPRequest httpRequest, org.apache.commons.httpclient.HttpMethodBase httpMethodClient)
httpRequest
- The HTTP requesthttpMethodClient
- The apache HTTP methodprotected org.apache.commons.httpclient.methods.RequestEntity createStringRequestContent(HTTPRequest httpRequest)
httpRequest
- The HTTP requestprotected org.apache.commons.httpclient.methods.RequestEntity createBinaryRequestContent(HTTPRequest httpRequest)
httpRequest
- The HTTP requestprotected org.apache.commons.httpclient.methods.RequestEntity createMultiPartRequestContent(HTTPRequest httpRequest, org.apache.commons.httpclient.HttpMethodBase httpMethodClient)
httpRequest
- The HTTP requesthttpMethodClient
- The apache HTTP methodprotected void setRequestContent(HTTPRequest httpRequest, org.apache.commons.httpclient.HttpMethodBase httpMethodClient)
httpRequest
- The HTTP requesthttpMethodClient
- The apache HTTP methodpublic HTTPResponse submitHTTPRequest(HTTPRequest httpRequest, HTTPClientConfiguration httpClientConfiguration, HTTPClient.HTTPMethod httpMethod)
httpRequest
- The HTTP request to sendhttpClientConfiguration
- HTTP client configurationhttpMethod
- The HTTP method to useCopyright © 2009–2020 fax4j. All rights reserved.