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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.nanohttpd.protocols.http.response.Responsedelete(HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) Handles an HTTP DELETE request.org.nanohttpd.protocols.http.response.Responseget(HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) Handles an HTTP GET request.abstract InputStreamgetData()Get data input stream.abstract StringMIME type of the streamed data.abstract org.nanohttpd.protocols.http.response.IStatusHTTP status of the response.org.nanohttpd.protocols.http.response.Responseother(String method, HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) Handles any other HTTP method.org.nanohttpd.protocols.http.response.Responsepost(HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) Handles an HTTP POST request.org.nanohttpd.protocols.http.response.Responseput(HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) Handles an HTTP PUT request.
-
Constructor Details
-
DefaultStreamHandler
public DefaultStreamHandler()Default constructor.
-
-
Method Details
-
getMimeType
-
getStatus
public abstract org.nanohttpd.protocols.http.response.IStatus getStatus()HTTP status of the response.- Returns:
- the response status
-
getData
-
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.UriResponderHandles an HTTP GET request.- Specified by:
getin interfaceHTTPServer.UriResponder- Parameters:
uriResource- the route that matched the requesturlParams- the parameters extracted from the URIsession- 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.UriResponderHandles an HTTP POST request.- Specified by:
postin interfaceHTTPServer.UriResponder- Parameters:
uriResource- the route that matched the requesturlParams- the parameters extracted from the URIsession- 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.UriResponderHandles an HTTP PUT request.- Specified by:
putin interfaceHTTPServer.UriResponder- Parameters:
uriResource- the route that matched the requesturlParams- the parameters extracted from the URIsession- 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.UriResponderHandles an HTTP DELETE request.- Specified by:
deletein interfaceHTTPServer.UriResponder- Parameters:
uriResource- the route that matched the requesturlParams- the parameters extracted from the URIsession- 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.UriResponderHandles any other HTTP method.- Specified by:
otherin interfaceHTTPServer.UriResponder- Parameters:
method- the HTTP method nameuriResource- the route that matched the requesturlParams- the parameters extracted from the URIsession- the HTTP session- Returns:
- the response
-