public class ApacheHttpClient4Executor extends Object implements ClientExecutor
Modifier and Type | Field and Description |
---|---|
static String |
BYTE_MEMORY_UNIT |
protected boolean |
closed |
protected boolean |
createdHttpClient |
static String |
GIGABYTE_MEMORY_UNIT |
protected org.apache.http.client.HttpClient |
httpClient |
protected org.apache.http.protocol.HttpContext |
httpContext |
static String |
KILOBYTE_MEMORY_UNIT |
static String |
MEGABYTE_MEMORY_UNIT |
protected int |
responseBufferSize |
Constructor and Description |
---|
ApacheHttpClient4Executor() |
ApacheHttpClient4Executor(org.apache.http.client.HttpClient httpClient) |
ApacheHttpClient4Executor(org.apache.http.client.HttpClient httpClient,
org.apache.http.protocol.HttpContext httpContext) |
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.HttpEntity |
buildEntity(ClientRequest 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() |
void |
commitHeaders(ClientRequest request,
org.apache.http.client.methods.HttpRequestBase httpMethod) |
protected InputStream |
createBufferedStream(InputStream is) |
ClientRequest |
createRequest(String uriTemplate) |
ClientRequest |
createRequest(javax.ws.rs.core.UriBuilder uriBuilder) |
ClientResponse |
execute(ClientRequest request) |
static CaseInsensitiveMap<String> |
extractHeaders(org.apache.http.HttpResponse response) |
void |
finalize() |
org.apache.http.client.HttpClient |
getHttpClient() |
org.apache.http.protocol.HttpContext |
getHttpContext() |
int |
getResponseBufferSize()
Response stream is wrapped in a BufferedInputStream.
|
protected String |
getTempfilePrefix()
Use context information, which will include node name, to avoid conflicts in case of multiple VMS using same
temp directory location.
|
boolean |
isClosed() |
void |
loadHttpMethod(ClientRequest request,
org.apache.http.client.methods.HttpRequestBase httpMethod) |
void |
setFileUploadInMemoryThresholdLimit(int pInMemoryThresholdLimit)
Setter for
fileUploadInMemoryThresholdLimit |
void |
setFileUploadMemoryUnit(String pMemoryUnit)
Setter for
fileUploadMemoryUnit |
void |
setFileUploadTempFileDir(File pTempFileDir)
Setter for
fileUploadTempFileDir |
void |
setHttpContext(org.apache.http.protocol.HttpContext httpContext) |
void |
setResponseBufferSize(int responseBufferSize)
Response stream is wrapped in a BufferedInputStream.
|
public static final String BYTE_MEMORY_UNIT
public static final String KILOBYTE_MEMORY_UNIT
public static final String MEGABYTE_MEMORY_UNIT
public static final String GIGABYTE_MEMORY_UNIT
protected org.apache.http.client.HttpClient httpClient
protected boolean createdHttpClient
protected org.apache.http.protocol.HttpContext httpContext
protected boolean closed
protected int responseBufferSize
public ApacheHttpClient4Executor()
public ApacheHttpClient4Executor(org.apache.http.client.HttpClient httpClient)
public ApacheHttpClient4Executor(org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext)
public int getResponseBufferSize()
public void setResponseBufferSize(int responseBufferSize)
responseBufferSize
- public org.apache.http.client.HttpClient getHttpClient()
public org.apache.http.protocol.HttpContext getHttpContext()
public void setHttpContext(org.apache.http.protocol.HttpContext httpContext)
public static CaseInsensitiveMap<String> extractHeaders(org.apache.http.HttpResponse response)
public ClientRequest createRequest(String uriTemplate)
createRequest
in interface ClientExecutor
public ClientRequest createRequest(javax.ws.rs.core.UriBuilder uriBuilder)
createRequest
in interface ClientExecutor
protected InputStream createBufferedStream(InputStream is)
public ClientResponse execute(ClientRequest request) throws Exception
execute
in interface ClientExecutor
Exception
protected void cleanUpAfterExecute(org.apache.http.client.methods.HttpRequestBase httpMethod)
httpMethod
- - the httpMethod to clean up.writeRequestBodyToOutputStream(ClientRequest)
public void loadHttpMethod(ClientRequest request, org.apache.http.client.methods.HttpRequestBase httpMethod) throws Exception
Exception
protected org.apache.http.HttpEntity buildEntity(ClientRequest request) throws IOException
FileExposingFileEntity
or a regular in-memory ByteArrayEntity
depending on if the request
OutputStream fit into memory when built by calling writeRequestBodyToOutputStream(ClientRequest)
.request
- -IOException
- -protected String getTempfilePrefix()
public void setFileUploadInMemoryThresholdLimit(int pInMemoryThresholdLimit)
fileUploadInMemoryThresholdLimit
pInMemoryThresholdLimit
- - the inMemoryThresholdLimitMB to setpublic void setFileUploadTempFileDir(File pTempFileDir)
fileUploadTempFileDir
pTempFileDir
- the tempFileDir to setpublic void setFileUploadMemoryUnit(String pMemoryUnit)
fileUploadMemoryUnit
pMemoryUnit
- the memoryUnit to setpublic void commitHeaders(ClientRequest request, org.apache.http.client.methods.HttpRequestBase httpMethod)
public void close()
close
in interface ClientExecutor
public boolean isClosed()
Copyright © 2018 JBoss by Red Hat. All rights reserved.