Class HTTPControllerBase
The HTTPControllerBass class that all concrete controllers should inherit from.
Inheritance
Implements
Inherited Members
Namespace:
Assembly: .dll
Syntax
public abstract class HTTPControllerBase implements RouterNanoHTTPD.UriResponder
Constructors
HTTPControllerBase()
Declaration
public HTTPControllerBase()
Fields
JSON_MIME_TYPE
Declaration
protected static final String JSON_MIME_TYPE
Field Value
Type | Description |
---|---|
java.lang.String |
logger
A log4j logger instance.
Declaration
protected Logger logger
Field Value
Type | Description |
---|---|
org.apache.logging.log4j.Logger |
Methods
delete(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Declaration
public Response delete(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Parameters
Type | Name | Description |
---|---|---|
org.nanohttpd.router.RouterNanoHTTPD.UriResource | uriResource | |
java.util.Map<java.lang.String,java.lang.String> | urlParams | |
org.nanohttpd.protocols.http.IHTTPSession | session |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response |
get(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Declaration
public Response get(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Parameters
Type | Name | Description |
---|---|---|
org.nanohttpd.router.RouterNanoHTTPD.UriResource | uriResource | |
java.util.Map<java.lang.String,java.lang.String> | urlParams | |
org.nanohttpd.protocols.http.IHTTPSession | session |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response |
getBadRequestResponse(String error)
Gets a generic BadRequest (Code 400) response.
Declaration
protected static final Response getBadRequestResponse(String error)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | error | The error to put in the response body |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response | A HTTP response |
getForbiddenResponse(String error)
Gets a generic Forbidden (Code 403) response.
Declaration
protected static final Response getForbiddenResponse(String error)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | error | The error to put in the response body |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response | A HTTP response |
getJsonResponse(Object o)
Gets a generic json response.
Declaration
protected static final Response getJsonResponse(Object o)
Parameters
Type | Name | Description |
---|---|---|
java.lang.Object | o | The object serialize as json and put into the response body |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response | A HTTP response |
getJsonResponse(String json)
Gets a generic json response.
Declaration
protected static final Response getJsonResponse(String json)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | json | The json string to put into the response body |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response | A HTTP response |
getNotFoundResponse(RouterNanoHTTPD.UriResource uriResource)
Gets a generic NotFound (Code 404) response for the given uri resource.
Declaration
protected static final Response getNotFoundResponse(RouterNanoHTTPD.UriResource uriResource)
Parameters
Type | Name | Description |
---|---|---|
org.nanohttpd.router.RouterNanoHTTPD.UriResource | uriResource | The uriResource that wasnt found |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response | A HTTP response |
getNotFoundResponse(RouterNanoHTTPD.UriResource uriResource, String additionalMessage)
Gets a generic NotFound (Code 404) response for the given uri resource.
Declaration
protected static final Response getNotFoundResponse(RouterNanoHTTPD.UriResource uriResource, String additionalMessage)
Parameters
Type | Name | Description |
---|---|---|
org.nanohttpd.router.RouterNanoHTTPD.UriResource | uriResource | The uriResource that wasnt found |
java.lang.String | additionalMessage | An additional message |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response | A HTTP response |
getOkResponse(String message)
Gets a generic Ok (Code 200) response.
Declaration
public static final Response getOkResponse(String message)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | message | The message to put in the body |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response | A HTTP response |
handleGet(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Handler for HTTP GET requests.
Declaration
public abstract Response handleGet(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Parameters
Type | Name | Description |
---|---|---|
org.nanohttpd.router.RouterNanoHTTPD.UriResource | uriResource | The UriResource |
java.util.Map<java.lang.String,java.lang.String> | urlParams | The url parameters |
org.nanohttpd.protocols.http.IHTTPSession | session | The HTTP session |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response | A HTTP response |
handlePost(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Handler for HTTP POST requests.
Declaration
public abstract Response handlePost(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Parameters
Type | Name | Description |
---|---|---|
org.nanohttpd.router.RouterNanoHTTPD.UriResource | uriResource | The uri resource |
java.util.Map<java.lang.String,java.lang.String> | urlParams | The url parameters |
org.nanohttpd.protocols.http.IHTTPSession | session | The HTTP session |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response | A HTTP response |
other(String method, RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Declaration
public Response other(String method, RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | method | |
org.nanohttpd.router.RouterNanoHTTPD.UriResource | uriResource | |
java.util.Map<java.lang.String,java.lang.String> | urlParams | |
org.nanohttpd.protocols.http.IHTTPSession | session |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response |
post(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Declaration
public Response post(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Parameters
Type | Name | Description |
---|---|---|
org.nanohttpd.router.RouterNanoHTTPD.UriResource | uriResource | |
java.util.Map<java.lang.String,java.lang.String> | urlParams | |
org.nanohttpd.protocols.http.IHTTPSession | session |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response |
put(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Declaration
public Response put(RouterNanoHTTPD.UriResource uriResource, Map<String,String> urlParams, IHTTPSession session)
Parameters
Type | Name | Description |
---|---|---|
org.nanohttpd.router.RouterNanoHTTPD.UriResource | uriResource | |
java.util.Map<java.lang.String,java.lang.String> | urlParams | |
org.nanohttpd.protocols.http.IHTTPSession | session |
Returns
Type | Description |
---|---|
org.nanohttpd.protocols.http.response.Response |