- All Known Implementing Classes:
Response
public interface IResponse
An interface for
Response
. Built
to enable easier testing on web handlers.-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getBody()
Returns the bytes of the Response body being sent to the clientlong
Gets the length of the body for this response.Any extra headers set on the Response by the developerTheStatusLine.StatusCode
set by the developer for this Response.boolean
Whether the body is text (rather than binary) If true, a method likeResponse.buildResponse(StatusLine.StatusCode, Map, String)
was used, meaning the body would benefit from compression (if large enough to warrant the performance hit from compressing it)void
By calling this method with aISocketWrapper
parameter, the method will send bytes on the associated socket.
-
Method Details
-
getExtraHeaders
Any extra headers set on the Response by the developer -
getStatusCode
StatusLine.StatusCode getStatusCode()TheStatusLine.StatusCode
set by the developer for this Response. -
isBodyText
boolean isBodyText()Whether the body is text (rather than binary) If true, a method likeResponse.buildResponse(StatusLine.StatusCode, Map, String)
was used, meaning the body would benefit from compression (if large enough to warrant the performance hit from compressing it) -
getBodyLength
long getBodyLength()Gets the length of the body for this response. If the body is an array of bytes set by the user, we grab this value by the length() method. If the outgoing data is set by a lambda, the user will set the bodyLength value. -
sendBody
By calling this method with aISocketWrapper
parameter, the method will send bytes on the associated socket.- Throws:
IOException
-
getBody
byte[] getBody()Returns the bytes of the Response body being sent to the client
-