public class HttpProducer
extends org.apache.camel.support.DefaultProducer
| Constructor and Description |
|---|
HttpProducer(HttpEndpoint endpoint) |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.http.HttpHost |
createHost(org.apache.http.client.methods.HttpRequestBase httpRequest,
org.apache.camel.Exchange exchange)
Creates the HttpHost to use to call the remote server
|
protected org.apache.http.client.methods.HttpRequestBase |
createMethod(org.apache.camel.Exchange exchange)
Creates the HttpMethod to use to call the remote server, either its GET or POST.
|
protected org.apache.http.HttpEntity |
createRequestEntity(org.apache.camel.Exchange exchange)
Creates a holder object for the data to send to the remote server.
|
protected void |
doInit() |
protected org.apache.http.HttpResponse |
executeMethod(org.apache.http.HttpHost httpHost,
org.apache.http.client.methods.HttpUriRequest httpRequest)
Strategy when executing the method (calling the remote server).
|
protected Object |
extractResponseBody(org.apache.http.client.methods.HttpRequestBase httpRequest,
org.apache.http.HttpResponse httpResponse,
org.apache.camel.Exchange exchange,
boolean ignoreResponseBody)
Extracts the response from the method as a InputStream.
|
protected static Map<String,String> |
extractResponseHeaders(org.apache.http.Header[] responseHeaders)
Extracts the response headers
|
HttpEndpoint |
getEndpoint() |
org.apache.http.client.HttpClient |
getHttpClient() |
protected Exception |
populateHttpOperationFailedException(org.apache.camel.Exchange exchange,
org.apache.http.client.methods.HttpRequestBase httpRequest,
org.apache.http.HttpResponse httpResponse,
int responseCode) |
protected void |
populateResponse(org.apache.camel.Exchange exchange,
org.apache.http.client.methods.HttpRequestBase httpRequest,
org.apache.http.HttpResponse httpResponse,
org.apache.camel.Message in,
org.apache.camel.spi.HeaderFilterStrategy strategy,
int responseCode) |
void |
process(org.apache.camel.Exchange exchange) |
void |
setHttpClient(org.apache.http.client.HttpClient httpClient) |
createExchange, doStart, doStop, isSingleton, toStringbuild, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic HttpProducer(HttpEndpoint endpoint)
protected void doInit()
throws Exception
doInit in class org.apache.camel.support.service.BaseServiceExceptionpublic HttpEndpoint getEndpoint()
getEndpoint in interface org.apache.camel.EndpointAwaregetEndpoint in class org.apache.camel.support.DefaultProducerprotected void populateResponse(org.apache.camel.Exchange exchange,
org.apache.http.client.methods.HttpRequestBase httpRequest,
org.apache.http.HttpResponse httpResponse,
org.apache.camel.Message in,
org.apache.camel.spi.HeaderFilterStrategy strategy,
int responseCode)
throws IOException,
ClassNotFoundException
IOExceptionClassNotFoundExceptionprotected Exception populateHttpOperationFailedException(org.apache.camel.Exchange exchange, org.apache.http.client.methods.HttpRequestBase httpRequest, org.apache.http.HttpResponse httpResponse, int responseCode) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionprotected org.apache.http.HttpResponse executeMethod(org.apache.http.HttpHost httpHost,
org.apache.http.client.methods.HttpUriRequest httpRequest)
throws IOException
httpHost - the http host to callhttpRequest - the http request to executeIOException - can be thrownprotected static Map<String,String> extractResponseHeaders(org.apache.http.Header[] responseHeaders)
responseHeaders - the headersprotected Object extractResponseBody(org.apache.http.client.methods.HttpRequestBase httpRequest, org.apache.http.HttpResponse httpResponse, org.apache.camel.Exchange exchange, boolean ignoreResponseBody) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionprotected org.apache.http.HttpHost createHost(org.apache.http.client.methods.HttpRequestBase httpRequest,
org.apache.camel.Exchange exchange)
protected org.apache.http.client.methods.HttpRequestBase createMethod(org.apache.camel.Exchange exchange)
throws Exception
exchange - the exchangeURISyntaxException - is thrown if the URI is invalidException - is thrown if error creating RequestEntityprotected org.apache.http.HttpEntity createRequestEntity(org.apache.camel.Exchange exchange)
throws org.apache.camel.CamelExchangeException
exchange - the exchange with the IN message with data to sendorg.apache.camel.CamelExchangeException - is thrown if error creating RequestEntitypublic org.apache.http.client.HttpClient getHttpClient()
public void setHttpClient(org.apache.http.client.HttpClient httpClient)
Apache Camel