Class FileResponse

java.lang.Object
net.jonathangiles.tools.teenyhttpd.response.Response
net.jonathangiles.tools.teenyhttpd.response.FileResponse

public class FileResponse extends Response
  • Constructor Details

    • FileResponse

      public FileResponse(Request request)
  • Method Details

    • getStatusCode

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

      public List<String> getHeaders()
      Specified by:
      getHeaders in class Response
    • writeBody

      public void writeBody(BufferedOutputStream dataOut) throws IOException
      Specified by:
      writeBody in class 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.