Class BeetRootHTTPSession
java.lang.Object
org.nanohttpd.protocols.http.HTTPSession
ch.autumo.beetroot.BeetRootHTTPSession
- All Implemented Interfaces:
org.nanohttpd.protocols.http.IHTTPSession
public class BeetRootHTTPSession
extends org.nanohttpd.protocols.http.HTTPSession
BeetRoot HTTP session.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.slf4j.LoggerLogger for this class.static final intResponse buffer size.static final intDownload response buffer size.static final intUpload buffer size.Fields inherited from class org.nanohttpd.protocols.http.HTTPSession
BUFSIZE, cookies, headers, MAX_HEADER_SIZE, method, parms, POST_DATA, protocolVersion, tempFileManager, uri -
Constructor Summary
ConstructorsConstructorDescriptionBeetRootHTTPSession(String externalSessionId, org.nanohttpd.protocols.http.tempfiles.ITempFileManager tempFileManager, InputStream inputStream) Constructor used for external servlet containers.BeetRootHTTPSession(org.nanohttpd.protocols.http.NanoHTTPD httpd, org.nanohttpd.protocols.http.tempfiles.ITempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream) Creates the HTTP session.BeetRootHTTPSession(org.nanohttpd.protocols.http.NanoHTTPD httpd, org.nanohttpd.protocols.http.tempfiles.ITempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream, InetAddress inetAddress) Creates the HTTP session for a client address. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteForServlet(BeetRootService beetRootService, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Provide a method for executing the request and response for the HTTP body only from the servlet context in this nano/beetRoot session.Returns the session id of the external servlet container.Get user session for this HTTP session.voidoverwriteParameter(String key, String value) Overwrites existing parameter or adds it if it doens't exist.voidparseBodyForServlet(Map<String, String> files, jakarta.servlet.http.HttpServletRequest request) Provide a method for parsing the body from a servlet context in this nano session.voidupdateParameter(String key, String value) Update one parameter.Methods inherited from class org.nanohttpd.protocols.http.HTTPSession
execute, getBodySize, getCookies, getHeaders, getInputStream, getMethod, getParameters, getParms, getQueryParameterString, getRemoteIpAddress, getUri, parseBody, saveTmpFile
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger for this class. -
UPLOAD_BUFFER_SIZE
public static final int UPLOAD_BUFFER_SIZEUpload buffer size. -
RESPONSE_BUFFER_SIZE
public static final int RESPONSE_BUFFER_SIZEResponse buffer size. -
RESPONSE_DOWNLOAD_BUFFER_SIZE
public static final int RESPONSE_DOWNLOAD_BUFFER_SIZEDownload response buffer size.
-
-
Constructor Details
-
BeetRootHTTPSession
public BeetRootHTTPSession(org.nanohttpd.protocols.http.NanoHTTPD httpd, org.nanohttpd.protocols.http.tempfiles.ITempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream) Creates the HTTP session.- Parameters:
httpd- the servertempFileManager- the temporary file managerinputStream- the input streamoutputStream- the output stream
-
BeetRootHTTPSession
public BeetRootHTTPSession(org.nanohttpd.protocols.http.NanoHTTPD httpd, org.nanohttpd.protocols.http.tempfiles.ITempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream, InetAddress inetAddress) Creates the HTTP session for a client address.- Parameters:
httpd- the servertempFileManager- the temporary file managerinputStream- the input streamoutputStream- the output streaminetAddress- the client address
-
BeetRootHTTPSession
public BeetRootHTTPSession(String externalSessionId, org.nanohttpd.protocols.http.tempfiles.ITempFileManager tempFileManager, InputStream inputStream) Constructor used for external servlet containers.- Parameters:
externalSessionId- external session idtempFileManager- temp file managerinputStream- http input stream
-
-
Method Details
-
getExternalSessionId
Returns the session id of the external servlet container.- Returns:
- the external session id
-
executeForServlet
public void executeForServlet(BeetRootService beetRootService, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException Provide a method for executing the request and response for the HTTP body only from the servlet context in this nano/beetRoot session.- Parameters:
beetRootService- beetRoot service, in this case the beetRoor server when running in a web container!request- HTTP requestresponse- HTTP response- Throws:
IOException- IO exception
-
parseBodyForServlet
public void parseBodyForServlet(Map<String, String> files, jakarta.servlet.http.HttpServletRequest request) throws IOException, org.nanohttpd.protocols.http.NanoHTTPD.ResponseExceptionProvide a method for parsing the body from a servlet context in this nano session.- Parameters:
files- the map for the filesrequest- HttpServletRequest- Throws:
IOException- IO exceptionorg.nanohttpd.protocols.http.NanoHTTPD.ResponseException- response exception
-
getUserSession
-
updateParameter
-
overwriteParameter
-