public class HTTPRequest
extends java.lang.Object
HTTPClient.newRequest(String, String)
Constructor and Description |
---|
HTTPRequest(com.dkfqs.tools.http.HTTPClientContext httpClientContext,
java.lang.String httpRequestMethod,
java.lang.String url)
Create and initialize a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getContext()
Get the (optional) context.
|
long |
getEndSendTimestamp()
Get the timestamp when the last byte of the HTTP request was sent (inclusive flushing the network connection).
|
java.lang.Exception |
getErrorException()
Get if a non HTTP error has occurred during processing of the HTTP request or response.
|
HTTPRequestContent |
getHttpRequestContent()
Get the HTTP request content.
|
HTTPRequestHeader |
getHttpRequestHeader()
Get access to the HTTP request header.
|
java.lang.String |
getHttpRequestMethod()
Get the the HTTP request method.
|
long |
getId()
Get the unique, internal request id.
|
int |
getNumberOfRetries()
Get the number of retries of the HTTP call.
|
ParseURL |
getParseURL()
Get the parsed URL.
|
java.lang.String |
getProcessingThreadName()
Get the (optional) temporary thread name for processing this request.
|
long |
getRequestInitializeTimestamp()
Get the timestamp when the request was initialized.
|
long |
getRequestSpecificProcessingTimeoutMillis()
Get the request specific HTTP processing timeout.
|
long |
getRequestStartProcessingTimestamp()
Get the timestamp when the request was becoming into the processing state.
|
long |
getSendTimeMillis()
Get the elapsed time duration for sending the HTTP request.
|
long |
getStartRetryTimestamp()
Get the start retry timestamp of the HTTP call.
|
long |
getStartSendTimestamp()
Get the timestamp of the start of sending the HTTP request.
|
long |
getTotalRequestSize()
Get the total request size.
|
java.lang.String |
getUrl()
Get the URL, as passed by the constructor.
|
boolean |
hasErrorException()
Get if a non HTTP error has occurred during processing of the HTTP request or response.
|
boolean |
hasHttpRequestContent()
Get if the HTTP request has a request content.
|
static java.lang.String |
internalProcessStateToString(int internalProcessState)
Static: get the string representation of the internal processing state.
|
void |
replaceUrl(java.lang.String newUrl)
For HTTP Client debugger only! Completely replace the URL by a new one.
|
void |
setContext(java.lang.Object context)
Set an (optional) context.
|
void |
setHttpRequestContent(HTTPRequestContent httpRequestContent,
java.lang.String contentType)
Add a HTTP request content.
|
void |
setProcessingThreadName(java.lang.String processingThreadName)
Set the (optional) temporary thread name for processing this request.
|
void |
setRequestSpecificProcessingTimeoutMillis(long requestSpecificProcessingTimeoutMillis)
Set the request specific HTTP processing timeout.
|
JsonObject |
toJsonObject()
Get a JSON object of this instance.
|
public HTTPRequest(com.dkfqs.tools.http.HTTPClientContext httpClientContext, java.lang.String httpRequestMethod, java.lang.String url) throws java.net.MalformedURLException
httpClientContext
- the HTTP client contexthttpRequestMethod
- the HTTP request method. Example: 'GET', 'POST', 'HEAD'url
- the full URL. Example: 'https://www.dkfqa.com/'java.net.MalformedURLException
- if the URL is invalidpublic long getId()
public void setProcessingThreadName(java.lang.String processingThreadName)
processingThreadName
- the temporary thread name for processing this requestpublic java.lang.String getProcessingThreadName()
public void setContext(java.lang.Object context)
context
- the context.getContext()
public java.lang.Object getContext()
setContext(Object)
public void setHttpRequestContent(HTTPRequestContent httpRequestContent, java.lang.String contentType)
httpRequestContent
- the HTTP request contentcontentType
- the content (MINE) type, or null if no 'Content-Type' should be set in the HTTP request headerpublic boolean hasHttpRequestContent()
public HTTPRequestContent getHttpRequestContent()
public long getRequestInitializeTimestamp()
public long getRequestStartProcessingTimestamp()
public long getRequestSpecificProcessingTimeoutMillis()
HTTPClient.setHTTPProcessingTimeout(int)
public void setRequestSpecificProcessingTimeoutMillis(long requestSpecificProcessingTimeoutMillis)
requestSpecificProcessingTimeoutMillis
- the request specific HTTP processing timeout in millisecondsjava.lang.IllegalArgumentException
- if the request specific HTTP processing timeout is less than 0public int getNumberOfRetries()
public long getStartRetryTimestamp()
public boolean hasErrorException()
public java.lang.Exception getErrorException()
public long getTotalRequestSize()
public long getStartSendTimestamp()
public long getSendTimeMillis()
public long getEndSendTimestamp()
public java.lang.String getHttpRequestMethod()
public java.lang.String getUrl()
public void replaceUrl(java.lang.String newUrl) throws java.net.MalformedURLException
newUrl
- the new URLjava.net.MalformedURLException
- if the new URL is malformedpublic ParseURL getParseURL()
public HTTPRequestHeader getHttpRequestHeader()
public static java.lang.String internalProcessStateToString(int internalProcessState)
internalProcessState
- the internal processing statepublic JsonObject toJsonObject()