- All Known Implementing Classes:
Request
public interface IRequest
An interface for
Request
. Built
to enable easier testing on web handlers.-
Method Summary
Modifier and TypeMethodDescriptiongetBody()
This getter will process the body data fully on the first call, and cache that data for subsequent calls.This method provides anIterable
for getting the partitions of a multipart-form formatted body in an HTTP request.Gets a string of the ip address of the client sending this request.Obtain information about the first line.This getter is expected to be used for situations required finer-grained control over the socket, such as when dealing with streaming input like a game or chat, or receiving a very large file like a video.This method provides anIterable
for getting the key-value pairs of a URL-encoded body in an HTTP request.
-
Method Details
-
getHeaders
Headers getHeaders() -
getRequestLine
RequestLine getRequestLine()Obtain information about the first line. An example of a RequestLine is:GET /foo?bar=baz HTTP/1.1
-
getBody
Body getBody()This getter will process the body data fully on the first call, and cache that data for subsequent calls.
If there is a need to deal with very large data, such as large images or videos, consider usinggetSocketWrapper()
instead, which will allow fine-grained control over pulling the bytes off the socket.
For instance, if expecting a video (a large file), it may be prudent to store the data into a file while it downloads, so that the server does not need to hold the entire file in memory. -
getRemoteRequester
String getRemoteRequester()Gets a string of the ip address of the client sending this request. For example, "123.123.123.123" -
getSocketWrapper
ISocketWrapper getSocketWrapper()This getter is expected to be used for situations required finer-grained control over the socket, such as when dealing with streaming input like a game or chat, or receiving a very large file like a video. This will enable the user to read and send on the socket - powerful, but requires care.
Note: This is an unusual method.
It is an error to call this in addition togetBody()
. Use one or the other. Mostly, expect to use getBody unless you really know what you are doing, such as streaming situations or custom body protocols. -
getUrlEncodedIterable
Iterable<UrlEncodedKeyValue> getUrlEncodedIterable()This method provides anIterable
for getting the key-value pairs of a URL-encoded body in an HTTP request. This method is intended to be used for situations where the developer requires greater control, for example, if allowing large uploads such as videos.
If this extra level of control is not needed, the developer would benefit more from using thegetBody()
method, which is far more convenient. -
getMultipartIterable
Iterable<StreamingMultipartPartition> getMultipartIterable()This method provides anIterable
for getting the partitions of a multipart-form formatted body in an HTTP request. This method is intended to be used for situations where the developer requires greater control, for example, if allowing large uploads such as videos.
If this extra level of control is not needed, the developer would benefit more from using thegetBody()
method, which is far more convenient.
-