Class HttpServerRequest
java.lang.Object
org.refcodes.web.AbstractHttpRequest
org.refcodes.web.HttpServerRequest
- All Implemented Interfaces:
HeaderFieldsAccessor<RequestHeaderFields>, HttpBodyAccessor, HttpInputStreamAccessor, HttpMethodAccessor, HttpRequest, UrlAccessor
public class HttpServerRequest
extends AbstractHttpRequest
implements HttpBodyAccessor, HttpInputStreamAccessor
Defines a
HttpServerRequest being the request as consumed by the
server.-
Nested Class Summary
Nested classes/interfaces inherited from interface HeaderFieldsAccessor
HeaderFieldsAccessor.HeaderFieldsBuilder<T,B>, HeaderFieldsAccessor.HeaderFieldsMutator<T>, HeaderFieldsAccessor.HeaderFieldsProperty<T> Nested classes/interfaces inherited from interface HttpBodyAccessor
HttpBodyAccessor.HttpBodyBuilder<B>, HttpBodyAccessor.HttpBodyMutator, HttpBodyAccessor.HttpBodyProperty, HttpBodyAccessor.HttpBodyProvider<EXC>Nested classes/interfaces inherited from interface HttpInputStreamAccessor
HttpInputStreamAccessor.HttpInputStreamBuilder<B>, HttpInputStreamAccessor.HttpInputStreamMutator, HttpInputStreamAccessor.HttpInputStreamProperty, HttpInputStreamAccessor.HttpInputStreamProvider<EXC>Nested classes/interfaces inherited from interface HttpMethodAccessor
HttpMethodAccessor.HttpMethodBuilder<B>, HttpMethodAccessor.HttpMethodMutator, HttpMethodAccessor.HttpMethodPropertyNested classes/interfaces inherited from interface UrlAccessor
UrlAccessor.UrlBuilder, UrlAccessor.UrlMutator, UrlAccessor.UrlProperty -
Field Summary
FieldsFields inherited from class AbstractHttpRequest
_headerFields, _httpMethod, _url -
Constructor Summary
ConstructorsConstructorDescriptionHttpServerRequest(HttpMethod aHttpMethod, Url aUrl, RequestHeaderFields aHeaderFields, InputStream aHttpInputStream, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Constructs aHttpServerRequestwith all required attributes. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the HTTP body from the HTTP body property.Retrieves theInputStreamfrom the HTTPInputStreamproperty.Retrieves theHttpBodyMaprepresenting the request body.<REQ> REQgetRequest(Class<REQ> aRequestType) This method's implementation supports theHttpBodyMapto unmarshal an HTTP Request-Body into anHttpBodyMapwhen providing theHttpBodyMapas request type.toString()Methods inherited from class AbstractHttpRequest
getHeaderFields, getHttpMethod, getUrl
-
Field Details
-
_mediaTypeFactoryLookup
-
-
Constructor Details
-
HttpServerRequest
public HttpServerRequest(HttpMethod aHttpMethod, Url aUrl, RequestHeaderFields aHeaderFields, InputStream aHttpInputStream, MediaTypeFactoryLookup aMediaTypeFactoryLookup) Constructs aHttpServerRequestwith all required attributes.- Parameters:
aHttpMethod- TheHttpMethodwith which the request has been sent.aUrl- TheUrlfrom which to take the URL specific data.aHeaderFields- TheRequestHeaderFieldssent by the request.aHttpInputStream- TheInputStreamrepresenting the request's HTTP body.aMediaTypeFactoryLookup- The lookup factory for retrieving the requiredMediaTypefactories.
-
-
Method Details
-
getRequest
Retrieves theHttpBodyMaprepresenting the request body.- Returns:
- An instance of the
HttpBodyMaprepresenting the request. - Throws:
BadRequestException- thrown when unmarshaling / deserializing an object fails.
-
getRequest
This method's implementation supports theHttpBodyMapto unmarshal an HTTP Request-Body into anHttpBodyMapwhen providing theHttpBodyMapas request type.- Type Parameters:
REQ- the generic type- Parameters:
aRequestType- the request type- Returns:
- the request
- Throws:
BadRequestException- the bad request exception
-
getHttpInputStream
Retrieves theInputStreamfrom the HTTPInputStreamproperty.- Specified by:
getHttpInputStreamin interfaceHttpInputStreamAccessor- Returns:
- The
InputStreamstored by theInputStreamproperty.
-
getHttpBody
Retrieves the HTTP body from the HTTP body property.- Specified by:
getHttpBodyin interfaceHttpBodyAccessor- Returns:
- The HTTP body stored by the HTTP body property.
-
toString
-