Class HttpFastStringResponse

java.lang.Object
net.targetr.wtm3.net.http.HttpResponse
net.targetr.wtm3.net.http.response.HttpFastStringResponse

public class HttpFastStringResponse extends HttpResponse
Plain text response without automatic ETags, gzip or byte-range handling.
Author:
Dr Michael Gardiner
  • Field Details

    • HEADER_CONTENT_LENGTH

      public static final String HEADER_CONTENT_LENGTH
      The Content-Length header string.
      See Also:
    • HEADER_CONTENT_TYPE

      public static final String HEADER_CONTENT_TYPE
      The Content-Type header string.
      See Also:
  • Constructor Details

    • HttpFastStringResponse

      public HttpFastStringResponse(String text)
      Creates a plain text response suitable for sending to a client with content type of text/plain without adding ETag or gzip.
      Parameters:
      text - The text to send to client.
  • Method Details

    • write

      public void write(HttpRequest request, OutputStream out) throws Exception
      Writes headers and text, omitting the body for HEAD requests.
      Overrides:
      write in class HttpResponse
      Parameters:
      request - Request associated with response.
      out - The OutputStream to write the response.
      Throws:
      Exception - If an error occurs while writing the response.