Package com.avoka.tm.http
Class HttpResponse
java.lang.Object
com.avoka.tm.http.HttpResponse
Provides a HttpResponse value object class.
- Since:
- 5.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
long
Return the content as a XML Document object, or null if not defined.Return the map of HTTP response headers.Return the content as a Path object, or null if not defined.int
Return the content as a UTF-8 encoded string, or null if not defined.boolean
Return true if HTTP response is an client error status code (400-499).boolean
Return true if HTTP response is an informational status code (100-199).boolean
Return true if HTTP response is an redirection status code (300-399).boolean
Return true if HTTP response is an server error status code (500-599).boolean
Return true if the HTTP response status code is NOT FOUND (404).boolean
Return true if the HTTP response status code is OK (200).boolean
Return true if HTTP response is an success status code (200-299).setContent
(byte[] content) setContentEncoding
(String contentEncoding) setContentLength
(long contentLength) setContentType
(String contentType) setHeaders
(Map<String, String> headers) Set the map of HTTP response headers.setStatus
(int status) setStatusLine
(String statusLine) setTextContent
(String content) Sets the text content in the response.toString()
Return the string representation of this class.
-
Constructor Details
-
HttpResponse
public HttpResponse()
-
-
Method Details
-
getPathContent
Return the content as a Path object, or null if not defined.- Returns:
- the content as Path object
-
getDocumentContent
Return the content as a XML Document object, or null if not defined.- Returns:
- the content as a XML Document object, or null if not defined.
-
getHeaders
Return the map of HTTP response headers.- Returns:
- the map of HTTP response headers
-
setHeaders
Set the map of HTTP response headers.- Parameters:
headers
- the map of HTTP response headers- Returns:
- the HttpResponse value object
-
isStatusOK
public boolean isStatusOK()Return true if the HTTP response status code is OK (200).- Returns:
- true if the HTTP response status code is OK (200).
-
isStatusNotFound
public boolean isStatusNotFound()Return true if the HTTP response status code is NOT FOUND (404).- Returns:
- true if the HTTP response status code is NOT FOUND (404).
-
isInformational
public boolean isInformational()Return true if HTTP response is an informational status code (100-199).- Returns:
- true if HTTP response is an informational status code (100-199).
-
isSuccess
public boolean isSuccess()Return true if HTTP response is an success status code (200-299).- Returns:
- true if HTTP response is an success status code (200-299).
-
isRedirection
public boolean isRedirection()Return true if HTTP response is an redirection status code (300-399).- Returns:
- true if HTTP response is an redirection status code (300-399).
-
isClientError
public boolean isClientError()Return true if HTTP response is an client error status code (400-499).- Returns:
- true if HTTP response is an client error status code (400-499).
-
isServerError
public boolean isServerError()Return true if HTTP response is an server error status code (500-599).- Returns:
- true if HTTP response is an server error status code (500-599).
-
getStatus
public int getStatus()- Returns:
- the HTTP response status code
-
setStatus
- Parameters:
status
- the status to set- Returns:
- the HttpResponse value object
-
getStatusLine
- Returns:
- the statusLine
-
setStatusLine
- Parameters:
statusLine
- the statusLine to set- Returns:
- the HttpResponse value object
-
getContent
public byte[] getContent()- Returns:
- the content
-
setContent
- Parameters:
content
- the content to set- Returns:
- the HttpResponse value object
-
getContentLength
public long getContentLength()- Returns:
- the contentLength
-
setContentLength
- Parameters:
contentLength
- the contentLength to set- Returns:
- the HttpResponse value object
-
getContentType
- Returns:
- the contentType
-
setContentType
- Parameters:
contentType
- the contentType to set- Returns:
- the HttpResponse value object
-
getContentEncoding
- Returns:
- the contentEncoding
-
setContentEncoding
- Parameters:
contentEncoding
- the contentEncoding to set- Returns:
- the HttpResponse value object
-
getTextContent
Return the content as a UTF-8 encoded string, or null if not defined.- Returns:
- the content as a UTF-8 encoded string, or null if not defined.
-
setTextContent
Sets the text content in the response.- Parameters:
content
- the plain text content to set- Returns:
- the HttpResponse value object
- Since:
- 5.1.7
-
toString
Return the string representation of this class.
-