Package io.micronaut.http.poja.apache
Class ApacheServletHttpRequest<B>
java.lang.Object
io.micronaut.http.poja.PojaHttpRequest<B,org.apache.hc.core5.http.ClassicHttpRequest,org.apache.hc.core5.http.ClassicHttpResponse>
io.micronaut.http.poja.apache.ApacheServletHttpRequest<B>
- Type Parameters:
B
- Body type
- All Implemented Interfaces:
io.micronaut.core.attr.AttributeHolder
,io.micronaut.core.attr.MutableAttributeHolder
,io.micronaut.core.convert.ConversionServiceAware
,io.micronaut.http.HttpMessage<B>
,io.micronaut.http.HttpRequest<B>
,io.micronaut.http.MutableHttpMessage<B>
,io.micronaut.http.MutableHttpRequest<B>
,io.micronaut.http.ServerHttpRequest<B>
,ServletExchange<org.apache.hc.core5.http.ClassicHttpRequest,
,org.apache.hc.core5.http.ClassicHttpResponse> ServletHttpRequest<org.apache.hc.core5.http.ClassicHttpRequest,
,B> Closeable
,AutoCloseable
@Internal
public final class ApacheServletHttpRequest<B>
extends PojaHttpRequest<B,org.apache.hc.core5.http.ClassicHttpRequest,org.apache.hc.core5.http.ClassicHttpResponse>
An implementation of the POJA Http Request based on Apache.
- Since:
- 4.10.0
- Author:
- Andriy Dmytruk
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.servlet.http.ServletHttpRequest
ServletHttpRequest.AsyncExecution, ServletHttpRequest.AsyncExecutionCallback
-
Field Summary
Fields inherited from class io.micronaut.http.poja.PojaHttpRequest
attributes, codecRegistry, conversionService, CONVERTIBLE_VALUES_ARGUMENT
Fields inherited from interface io.micronaut.http.HttpRequest
SCHEME_HTTP, SCHEME_HTTPS
-
Constructor Summary
ConstructorsConstructorDescriptionApacheServletHttpRequest
(InputStream inputStream, io.micronaut.http.poja.apache.ApacheResponseContext responseContext, org.apache.hc.core5.http.io.SessionInputBuffer sessionInputBuffer, io.micronaut.core.convert.ConversionService conversionService, io.micronaut.http.codec.MediaTypeCodecRegistry codecRegistry, ExecutorService ioExecutor, io.micronaut.core.io.buffer.ByteBufferFactory<?, ?> byteBufferFactory) Create an Apache-based request. -
Method Summary
Modifier and TypeMethodDescription<T> io.micronaut.http.MutableHttpRequest<T>
body
(T body) @NonNull io.micronaut.http.body.ByteBody
byteBody()
io.micronaut.http.MutableHttpRequest<B>
cookie
(io.micronaut.http.cookie.Cookie cookie) ServletHttpResponse<org.apache.hc.core5.http.ClassicHttpResponse,
?> Create a new, empty response for this exchange.getBody()
@NonNull io.micronaut.http.cookie.Cookies
@NonNull io.micronaut.http.MutableHttpHeaders
@NonNull io.micronaut.http.HttpMethod
org.apache.hc.core5.http.ClassicHttpRequest
@NonNull io.micronaut.http.MutableHttpParameters
ServletHttpResponse<org.apache.hc.core5.http.ClassicHttpResponse,
?> Get the current response, the last response created byServletExchange.createResponse()
.@NonNull URI
getUri()
void
setConversionService
(@NonNull io.micronaut.core.convert.ConversionService conversionService) io.micronaut.http.MutableHttpRequest<B>
Methods inherited from class io.micronaut.http.poja.PojaHttpRequest
consumeBody, getAttributes, getBody, getFormData, getInputStream, getReader, getRequest, isFormSubmission
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttribute, getAttribute
Methods inherited from interface io.micronaut.http.HttpMessage
getBody, getBody, getBodyWriter, getCharacterEncoding, getContentLength, getContentType
Methods inherited from interface io.micronaut.http.HttpRequest
accept, getCertificate, getHttpVersion, getLocale, getMethodName, getOrigin, getPath, getRemoteAddress, getServerAddress, getServerName, getSslSession, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttribute, setUserPrincipal
Methods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttribute
Methods inherited from interface io.micronaut.http.MutableHttpMessage
bodyWriter
Methods inherited from interface io.micronaut.http.MutableHttpRequest
accept, accept, basicAuth, bearerAuth, contentEncoding, contentLength, contentType, contentType, cookies, header, headers, headers, toMutableRequest, uri
Methods inherited from interface io.micronaut.servlet.http.ServletExchange
close
Methods inherited from interface io.micronaut.servlet.http.ServletHttpRequest
executeAsync, getContextPath, isAsyncSupported
-
Constructor Details
-
ApacheServletHttpRequest
public ApacheServletHttpRequest(InputStream inputStream, io.micronaut.http.poja.apache.ApacheResponseContext responseContext, org.apache.hc.core5.http.io.SessionInputBuffer sessionInputBuffer, io.micronaut.core.convert.ConversionService conversionService, io.micronaut.http.codec.MediaTypeCodecRegistry codecRegistry, ExecutorService ioExecutor, io.micronaut.core.io.buffer.ByteBufferFactory<?, ?> byteBufferFactory) Create an Apache-based request.- Parameters:
inputStream
- The input streamresponseContext
- The response contextsessionInputBuffer
- Input buffer for parsingconversionService
- The conversion servicecodecRegistry
- The media codec registryioExecutor
- The executor servicebyteBufferFactory
- The byte buffer factory
-
-
Method Details
-
getResponse
Description copied from interface:ServletExchange
Get the current response, the last response created byServletExchange.createResponse()
.- Returns:
- The response object
-
createResponse
Description copied from interface:ServletExchange
Create a new, empty response for this exchange. Only the last response created for a request is fully backed by the servlet container response, meaning it can accessServletHttpResponse.getOutputStream()
and similar methods.- Returns:
- The response
-
getNativeRequest
public org.apache.hc.core5.http.ClassicHttpRequest getNativeRequest()- Returns:
- The native request type
-
getCookies
@NonNull public @NonNull io.micronaut.http.cookie.Cookies getCookies() -
getParameters
@NonNull public @NonNull io.micronaut.http.MutableHttpParameters getParameters() -
getMethod
@NonNull public @NonNull io.micronaut.http.HttpMethod getMethod() -
getUri
-
cookie
-
uri
-
body
public <T> io.micronaut.http.MutableHttpRequest<T> body(T body) -
getHeaders
@NonNull public @NonNull io.micronaut.http.MutableHttpHeaders getHeaders() -
getBody
-
byteBody
@NonNull public @NonNull io.micronaut.http.body.ByteBody byteBody()- Specified by:
byteBody
in interfaceio.micronaut.http.ServerHttpRequest<B>
- Specified by:
byteBody
in classPojaHttpRequest<B,
org.apache.hc.core5.http.ClassicHttpRequest, org.apache.hc.core5.http.ClassicHttpResponse>
-
setConversionService
public void setConversionService(@NonNull @NonNull io.micronaut.core.convert.ConversionService conversionService)
-