Class HTTPServer.DefaultStreamHandler

java.lang.Object
ch.autumo.beetroot.server.HTTPServer.DefaultStreamHandler
All Implemented Interfaces:
HTTPServer.UriResponder
Direct Known Subclasses:
HTTPServer.DefaultHandler
Enclosing class:
HTTPServer

public abstract static class HTTPServer.DefaultStreamHandler extends Object implements HTTPServer.UriResponder
General nanolet to inherit from if you provide stream data, only chucked responses will be generated.
  • Constructor Details

    • DefaultStreamHandler

      public DefaultStreamHandler()
      Default constructor.
  • Method Details

    • getMimeType

      public abstract String getMimeType()
      MIME type of the streamed data.
      Returns:
      the MIME type
    • getStatus

      public abstract org.nanohttpd.protocols.http.response.IStatus getStatus()
      HTTP status of the response.
      Returns:
      the response status
    • getData

      public abstract InputStream getData()
      Get data input stream.
      Returns:
      data input stream
    • get

      public org.nanohttpd.protocols.http.response.Response get(HTTPServer.UriResource uriResource, Map<String,String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session)
      Description copied from interface: HTTPServer.UriResponder
      Handles an HTTP GET request.
      Specified by:
      get in interface HTTPServer.UriResponder
      Parameters:
      uriResource - the route that matched the request
      urlParams - the parameters extracted from the URI
      session - the HTTP session
      Returns:
      the response
    • post

      public org.nanohttpd.protocols.http.response.Response post(HTTPServer.UriResource uriResource, Map<String,String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session)
      Description copied from interface: HTTPServer.UriResponder
      Handles an HTTP POST request.
      Specified by:
      post in interface HTTPServer.UriResponder
      Parameters:
      uriResource - the route that matched the request
      urlParams - the parameters extracted from the URI
      session - the HTTP session
      Returns:
      the response
    • put

      public org.nanohttpd.protocols.http.response.Response put(HTTPServer.UriResource uriResource, Map<String,String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session)
      Description copied from interface: HTTPServer.UriResponder
      Handles an HTTP PUT request.
      Specified by:
      put in interface HTTPServer.UriResponder
      Parameters:
      uriResource - the route that matched the request
      urlParams - the parameters extracted from the URI
      session - the HTTP session
      Returns:
      the response
    • delete

      public org.nanohttpd.protocols.http.response.Response delete(HTTPServer.UriResource uriResource, Map<String,String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session)
      Description copied from interface: HTTPServer.UriResponder
      Handles an HTTP DELETE request.
      Specified by:
      delete in interface HTTPServer.UriResponder
      Parameters:
      uriResource - the route that matched the request
      urlParams - the parameters extracted from the URI
      session - the HTTP session
      Returns:
      the response
    • other

      public org.nanohttpd.protocols.http.response.Response other(String method, HTTPServer.UriResource uriResource, Map<String,String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session)
      Description copied from interface: HTTPServer.UriResponder
      Handles any other HTTP method.
      Specified by:
      other in interface HTTPServer.UriResponder
      Parameters:
      method - the HTTP method name
      uriResource - the route that matched the request
      urlParams - the parameters extracted from the URI
      session - the HTTP session
      Returns:
      the response