Interface IResponse

All Known Implementing Classes:
Response

public interface IResponse
An interface for Response. Built to enable easier testing on web handlers.
  • Method Details

    • getExtraHeaders

      Map<String,String> getExtraHeaders()
      Any extra headers set on the Response by the developer
    • getStatusCode

      StatusLine.StatusCode getStatusCode()
      The StatusLine.StatusCode set by the developer for this Response.
    • isBodyText

      boolean isBodyText()
      Whether the body is text (rather than binary) If true, a method like Response.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

      void sendBody(ISocketWrapper sw) throws IOException
      By calling this method with a ISocketWrapper 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