- 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 clientlongGets the length of the body for this response.Any extra headers set on the Response by the developerTheStatusLine.StatusCodeset by the developer for this Response.booleanWhether 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)voidBy calling this method with aISocketWrapperparameter, 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.StatusCodeset 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 aISocketWrapperparameter, 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
-