public class ApacheHttpClient4Engine extends Object implements ClientHttpEngine
Modifier and Type | Class and Description |
---|---|
static class |
ApacheHttpClient4Engine.MemoryUnit
Enumeration to represent memory units.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
closed |
protected boolean |
createdHttpClient |
protected org.apache.http.HttpHost |
defaultProxy |
protected int |
fileUploadInMemoryThresholdLimit
For uploading File's over JAX-RS framework, this property, together with
fileUploadMemoryUnit ,
defines the maximum File size allowed in memory. |
protected ApacheHttpClient4Engine.MemoryUnit |
fileUploadMemoryUnit
The unit for
fileUploadInMemoryThresholdLimit . |
protected File |
fileUploadTempFileDir
Temp directory to write output request stream to.
|
protected HostnameVerifier |
hostnameVerifier |
protected org.apache.http.client.HttpClient |
httpClient |
protected org.apache.http.protocol.HttpContext |
httpContext |
protected int |
responseBufferSize |
protected SSLContext |
sslContext |
Constructor and Description |
---|
ApacheHttpClient4Engine() |
ApacheHttpClient4Engine(org.apache.http.client.HttpClient httpClient) |
ApacheHttpClient4Engine(org.apache.http.client.HttpClient httpClient,
boolean closeHttpClient) |
ApacheHttpClient4Engine(org.apache.http.client.HttpClient httpClient,
org.apache.http.protocol.HttpContext httpContext) |
ApacheHttpClient4Engine(org.apache.http.HttpHost defaultProxy) |
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.HttpEntity |
buildEntity(ClientInvocation request)
Build the HttpEntity to be sent to the Service as part of (POST) request.
|
protected void |
cleanUpAfterExecute(org.apache.http.client.methods.HttpRequestBase httpMethod)
If passed httpMethod is of type HttpPost then obtain its entity.
|
void |
close() |
protected void |
commitHeaders(ClientInvocation request,
org.apache.http.client.methods.HttpRequestBase httpMethod) |
protected InputStream |
createBufferedStream(InputStream is) |
protected org.apache.http.client.HttpClient |
createDefaultHttpClient() |
protected org.apache.http.client.methods.HttpRequestBase |
createHttpMethod(String url,
String restVerb) |
static CaseInsensitiveMap<String> |
extractHeaders(org.apache.http.HttpResponse response) |
void |
finalize() |
org.apache.http.HttpHost |
getDefaultProxy() |
int |
getFileUploadInMemoryThresholdLimit()
Based on memory unit
|
ApacheHttpClient4Engine.MemoryUnit |
getFileUploadMemoryUnit() |
File |
getFileUploadTempFileDir() |
HostnameVerifier |
getHostnameVerifier()
Needed for Client.getHostnameVerifier()
|
org.apache.http.client.HttpClient |
getHttpClient() |
org.apache.http.protocol.HttpContext |
getHttpContext() |
int |
getResponseBufferSize()
Response stream is wrapped in a BufferedInputStream.
|
SSLContext |
getSslContext()
Needed for Client.getSslContext();
|
protected String |
getTempfilePrefix()
Use context information, which will include node name, to avoid conflicts in case of multiple VMS using same
temp directory location.
|
ClientResponse |
invoke(ClientInvocation request) |
boolean |
isClosed() |
protected boolean |
isRedirectRequired(ClientInvocation request,
org.apache.http.client.methods.HttpRequestBase httpMethod) |
protected void |
loadHttpMethod(ClientInvocation request,
org.apache.http.client.methods.HttpRequestBase httpMethod) |
void |
setFileUploadInMemoryThresholdLimit(int fileUploadInMemoryThresholdLimit) |
void |
setFileUploadMemoryUnit(ApacheHttpClient4Engine.MemoryUnit fileUploadMemoryUnit) |
void |
setFileUploadTempFileDir(File fileUploadTempFileDir) |
void |
setHostnameVerifier(HostnameVerifier hostnameVerifier) |
void |
setHttpContext(org.apache.http.protocol.HttpContext httpContext) |
protected void |
setRedirectNotRequired(ClientInvocation request,
org.apache.http.client.methods.HttpRequestBase httpMethod) |
protected void |
setRedirectRequired(ClientInvocation request,
org.apache.http.client.methods.HttpRequestBase httpMethod) |
void |
setResponseBufferSize(int responseBufferSize)
Response stream is wrapped in a BufferedInputStream.
|
void |
setSslContext(SSLContext sslContext) |
protected org.apache.http.client.HttpClient httpClient
protected boolean createdHttpClient
protected org.apache.http.protocol.HttpContext httpContext
protected boolean closed
protected SSLContext sslContext
protected HostnameVerifier hostnameVerifier
protected int responseBufferSize
protected org.apache.http.HttpHost defaultProxy
protected int fileUploadInMemoryThresholdLimit
fileUploadMemoryUnit
,
defines the maximum File size allowed in memory. If fileSize exceeds this size, it will be stored to
fileUploadTempFileDir
. protected ApacheHttpClient4Engine.MemoryUnit fileUploadMemoryUnit
ApacheHttpClient4Engine.MemoryUnit
protected File fileUploadTempFileDir
public ApacheHttpClient4Engine()
public ApacheHttpClient4Engine(org.apache.http.HttpHost defaultProxy)
public ApacheHttpClient4Engine(org.apache.http.client.HttpClient httpClient)
public ApacheHttpClient4Engine(org.apache.http.client.HttpClient httpClient, boolean closeHttpClient)
public ApacheHttpClient4Engine(org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext)
public int getResponseBufferSize()
public void setResponseBufferSize(int responseBufferSize)
responseBufferSize
- public int getFileUploadInMemoryThresholdLimit()
public void setFileUploadInMemoryThresholdLimit(int fileUploadInMemoryThresholdLimit)
public ApacheHttpClient4Engine.MemoryUnit getFileUploadMemoryUnit()
public void setFileUploadMemoryUnit(ApacheHttpClient4Engine.MemoryUnit fileUploadMemoryUnit)
public File getFileUploadTempFileDir()
public void setFileUploadTempFileDir(File fileUploadTempFileDir)
public org.apache.http.client.HttpClient getHttpClient()
public org.apache.http.protocol.HttpContext getHttpContext()
public void setHttpContext(org.apache.http.protocol.HttpContext httpContext)
public SSLContext getSslContext()
ClientHttpEngine
getSslContext
in interface ClientHttpEngine
public void setSslContext(SSLContext sslContext)
public HostnameVerifier getHostnameVerifier()
ClientHttpEngine
getHostnameVerifier
in interface ClientHttpEngine
public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
public org.apache.http.HttpHost getDefaultProxy()
public static CaseInsensitiveMap<String> extractHeaders(org.apache.http.HttpResponse response)
protected InputStream createBufferedStream(InputStream is)
public ClientResponse invoke(ClientInvocation request)
invoke
in interface ClientHttpEngine
protected org.apache.http.client.methods.HttpRequestBase createHttpMethod(String url, String restVerb)
protected boolean isRedirectRequired(ClientInvocation request, org.apache.http.client.methods.HttpRequestBase httpMethod)
protected org.apache.http.client.HttpClient createDefaultHttpClient()
protected void setRedirectRequired(ClientInvocation request, org.apache.http.client.methods.HttpRequestBase httpMethod)
protected void setRedirectNotRequired(ClientInvocation request, org.apache.http.client.methods.HttpRequestBase httpMethod)
protected void loadHttpMethod(ClientInvocation request, org.apache.http.client.methods.HttpRequestBase httpMethod) throws Exception
Exception
protected void commitHeaders(ClientInvocation request, org.apache.http.client.methods.HttpRequestBase httpMethod)
public void close()
close
in interface ClientHttpEngine
public boolean isClosed()
public void finalize() throws Throwable
protected void cleanUpAfterExecute(org.apache.http.client.methods.HttpRequestBase httpMethod)
httpMethod
- - the httpMethod to clean up.protected org.apache.http.HttpEntity buildEntity(ClientInvocation request) throws IOException
FileExposingFileEntity
or a regular in-memory ByteArrayEntity
depending on if the request
OutputStream fit into memory when built by calling.request
- -IOException
- -protected String getTempfilePrefix()
Copyright © 2017 JBoss by Red Hat. All rights reserved.