Package snap.web
Class HTTPResponse
java.lang.Object
snap.web.HTTPResponse
A class to represent an HTTP response.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a header for key.byte[]
getBytes()
Returns the bytes.int
getCode()
Returns the response return code.int
Returns the content length.Returns the content type.Returns the cookies.Returns the cookie string.Returns the headers.Returns the headers as a string.getJSON()
Returns the JSON.long
Returns the last modified time.Returns the response return message.long
Returns the response time in milliseconds.Returns a response summary string.getText()
Returns the response byte string.toString()
Standard toString implementation.Returns a string representation.
-
Field Details
-
_code
protected int _code -
_message
-
_contentType
-
_contentLength
protected int _contentLength -
_lastModified
protected long _lastModified -
_bytes
protected byte[] _bytes -
_cookies
-
_time
protected long _time -
OK
public static final int OK- See Also:
-
BAD_REQUEST
public static final int BAD_REQUEST- See Also:
-
UNAUTHORIZED
public static final int UNAUTHORIZED- See Also:
-
FORBIDDEN
public static final int FORBIDDEN- See Also:
-
NOT_FOUND
public static final int NOT_FOUND- See Also:
-
-
Constructor Details
-
HTTPResponse
public HTTPResponse()
-
-
Method Details
-
getCode
public int getCode()Returns the response return code. -
getMessage
Returns the response return message. -
getHeaders
Returns the headers. -
addHeader
Adds a header for key. -
getHeaderString
Returns the headers as a string. -
getCookies
Returns the cookies. -
getCookieString
Returns the cookie string. -
getContentType
Returns the content type. -
getContentLength
public int getContentLength()Returns the content length. -
getLastModified
public long getLastModified()Returns the last modified time. -
getBytes
public byte[] getBytes()Returns the bytes. -
getText
Returns the response byte string. -
getJSON
Returns the JSON. -
getResponseTime
public long getResponseTime()Returns the response time in milliseconds. -
getSummary
Returns a response summary string. -
toString
Standard toString implementation. -
toStringProps
Returns a string representation.
-