java.lang.Object
net.jonathangiles.tools.teenyhttpd.response.FileResponse
All Implemented Interfaces:
Response

public class FileResponse extends Object implements Response
  • Constructor Details

    • FileResponse

      public FileResponse(Request request)
  • Method Details

    • getStatusCode

      public StatusCode getStatusCode()
      Specified by:
      getStatusCode in interface Response
    • getHeaders

      public List<String> getHeaders()
      Specified by:
      getHeaders in interface Response
    • getBodyLength

      public long getBodyLength()
      Specified by:
      getBodyLength in interface Response
    • writeBody

      public void writeBody(BufferedOutputStream dataOut) throws IOException
      Specified by:
      writeBody in interface Response
      Throws:
      IOException
    • getFile

      protected File getFile(String filename)
      This method is called when the file is about to be loaded from the file system. Overriding it offers the opportunity of modifying where the file is retrieved from.
      Parameters:
      filename - The name of the file to be loaded, relative to the webroot (or otherwise).
      Returns:
      A File reference of the file being requested.