Class NanoHTTPD.HTTPSession
java.lang.Object
fi.iki.elonen.NanoHTTPD.HTTPSession
- All Implemented Interfaces:
NanoHTTPD.IHTTPSession
- Enclosing class:
NanoHTTPD
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprivate NanoHTTPD.CookieHandlerprivate final BufferedInputStreamstatic final intprivate static final intprivate NanoHTTPD.Methodprivate final OutputStreamprivate Stringprivate Stringprivate Stringprivate Stringprivate static final intprivate intprivate intprivate final NanoHTTPD.TempFileManagerprivate String -
Constructor Summary
ConstructorsConstructorDescriptionHTTPSession(NanoHTTPD.TempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream) HTTPSession(NanoHTTPD.TempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream, InetAddress inetAddress) -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddecodeHeader(BufferedReader in, Map<String, String> pre, Map<String, List<String>> parms, Map<String, String> headers) Decodes the sent headers and loads the data into Key/value pairsprivate voiddecodeMultipartFormData(NanoHTTPD.ContentType contentType, ByteBuffer fbuf, Map<String, List<String>> parms, Map<String, String> files) Decodes the Multipart Body data and put it into Key/Value pairs.private voidDecodes parameters in percent-encoded URI-format ( e.g.voidexecute()private intfindHeaderEnd(byte[] buf, int rlen) Find byte index separating header from body.longDeduce body length in bytes.private int[]getBoundaryPositions(ByteBuffer b, byte[] boundary) Find the byte positions where multipart boundaries start.final InputStreamfinal NanoHTTPD.MethodgetParms()Deprecated.Get the remote hostname of the requester.Get the remote ip address of the requester.private RandomAccessFilefinal StringgetUri()voidAdds the files in the request body to the files map.private StringsaveTmpFile(ByteBuffer b, int offset, int len, String filename_hint) Retrieves the content of a sent file and saves it to a temporary file.private intscipOverNewLine(byte[] partHeaderBuff, int index)
-
Field Details
-
REQUEST_BUFFER_LEN
private static final int REQUEST_BUFFER_LEN- See Also:
-
MEMORY_STORE_LIMIT
private static final int MEMORY_STORE_LIMIT- See Also:
-
BUFSIZE
public static final int BUFSIZE- See Also:
-
MAX_HEADER_SIZE
public static final int MAX_HEADER_SIZE- See Also:
-
tempFileManager
-
outputStream
-
inputStream
-
splitbyte
private int splitbyte -
rlen
private int rlen -
uri
-
method
-
parms
-
headers
-
cookies
-
queryParameterString
-
remoteIp
-
remoteHostname
-
protocolVersion
-
-
Constructor Details
-
HTTPSession
public HTTPSession(NanoHTTPD.TempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream) -
HTTPSession
public HTTPSession(NanoHTTPD.TempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream, InetAddress inetAddress)
-
-
Method Details
-
decodeHeader
private void decodeHeader(BufferedReader in, Map<String, String> pre, Map<String, List<String>> parms, Map<String, throws NanoHTTPD.ResponseExceptionString> headers) Decodes the sent headers and loads the data into Key/value pairs- Throws:
NanoHTTPD.ResponseException
-
decodeMultipartFormData
private void decodeMultipartFormData(NanoHTTPD.ContentType contentType, ByteBuffer fbuf, Map<String, List<String>> parms, Map<String, String> files) throws NanoHTTPD.ResponseExceptionDecodes the Multipart Body data and put it into Key/Value pairs.- Throws:
NanoHTTPD.ResponseException
-
scipOverNewLine
private int scipOverNewLine(byte[] partHeaderBuff, int index) -
decodeParms
-
execute
- Specified by:
executein interfaceNanoHTTPD.IHTTPSession- Throws:
IOException
-
findHeaderEnd
private int findHeaderEnd(byte[] buf, int rlen) Find byte index separating header from body. It must be the last byte of the first two sequential new lines. -
getBoundaryPositions
Find the byte positions where multipart boundaries start. This reads a large block at a time and uses a temporary buffer to optimize (memory mapped) file access. -
getCookies
- Specified by:
getCookiesin interfaceNanoHTTPD.IHTTPSession
-
getHeaders
- Specified by:
getHeadersin interfaceNanoHTTPD.IHTTPSession
-
getInputStream
- Specified by:
getInputStreamin interfaceNanoHTTPD.IHTTPSession
-
getMethod
- Specified by:
getMethodin interfaceNanoHTTPD.IHTTPSession
-
getParms
Deprecated.usegetParameters()instead.Description copied from interface:NanoHTTPD.IHTTPSessionThis method will only return the first value for a given parameter. You will want to use getParameters if you expect multiple values for a given key.- Specified by:
getParmsin interfaceNanoHTTPD.IHTTPSession
-
getParameters
- Specified by:
getParametersin interfaceNanoHTTPD.IHTTPSession
-
getQueryParameterString
- Specified by:
getQueryParameterStringin interfaceNanoHTTPD.IHTTPSession
-
getTmpBucket
-
getUri
- Specified by:
getUriin interfaceNanoHTTPD.IHTTPSession- Returns:
- the path part of the URL.
-
getBodySize
public long getBodySize()Deduce body length in bytes. Either from "content-length" header or read bytes. -
parseBody
Description copied from interface:NanoHTTPD.IHTTPSessionAdds the files in the request body to the files map.- Specified by:
parseBodyin interfaceNanoHTTPD.IHTTPSession- Parameters:
files- map to modify- Throws:
IOExceptionNanoHTTPD.ResponseException
-
saveTmpFile
Retrieves the content of a sent file and saves it to a temporary file. The full path to the saved file is returned. -
getRemoteIpAddress
Description copied from interface:NanoHTTPD.IHTTPSessionGet the remote ip address of the requester.- Specified by:
getRemoteIpAddressin interfaceNanoHTTPD.IHTTPSession- Returns:
- the IP address.
-
getRemoteHostName
Description copied from interface:NanoHTTPD.IHTTPSessionGet the remote hostname of the requester.- Specified by:
getRemoteHostNamein interfaceNanoHTTPD.IHTTPSession- Returns:
- the hostname.
-
getParameters()instead.