public class DefaultServiceRequestContext extends NonWrappingRequestContext implements ServiceRequestContext
ServiceRequestContext
implementation.Constructor and Description |
---|
DefaultServiceRequestContext(ServiceConfig cfg,
io.netty.channel.Channel ch,
SessionProtocol sessionProtocol,
java.lang.String method,
java.lang.String path,
java.lang.String mappedPath,
java.lang.Object request,
javax.net.ssl.SSLSession sslSession)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.ExecutorService |
blockingTaskExecutor()
Returns the
ExecutorService that could be used for executing a potentially long-running task. |
protected io.netty.channel.Channel |
channel()
Returns the
Channel that is handling this request, or null if the connection is not
established yet. |
io.netty.channel.EventLoop |
eventLoop()
Returns the
EventLoop that is handling the current Request . |
RequestLog |
log()
Returns the
RequestLog that contains the information about the current Request . |
RequestLogBuilder |
logBuilder()
Returns the
RequestLogBuilder that collects the information about the current Request . |
org.slf4j.Logger |
logger() |
java.lang.String |
mappedPath()
Returns the path with its context path removed.
|
long |
maxRequestLength()
Returns the maximum length of the current
Request . |
PathMapping |
pathMapping()
|
long |
requestTimeoutMillis()
Returns the amount of time allowed until receiving the current
Request completely. |
Server |
server()
|
<T extends Service<?,?>> |
service()
|
void |
setMaxRequestLength(long maxRequestLength)
Sets the maximum length of the current
Request . |
void |
setRequestTimeout(java.time.Duration requestTimeout)
Sets the amount of time allowed until receiving the current
Request completely. |
void |
setRequestTimeoutChangeListener(RequestTimeoutChangeListener listener)
Sets the listener that is notified when the requestTimeoutMillis() request timeout} of
the request is changed.
|
void |
setRequestTimeoutMillis(long requestTimeoutMillis)
Sets the amount of time allowed until receiving the current
Request completely. |
javax.net.ssl.SSLSession |
sslSession()
The
SSLSession for this request if the connection is made over TLS, or null if
the connection is not established yet or the connection is not a TLS connection. |
java.lang.String |
toString() |
VirtualHost |
virtualHost()
Returns the
VirtualHost that is handling the current Request . |
attr, attrs, hasAttr, invokeOnEnterCallbacks, invokeOnExitCallbacks, localAddress, method, onEnter, onExit, path, remoteAddress, request, sessionProtocol
contextAwareEventLoop, equals, hashCode, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, rejectPromise, resolvePromise
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
attrs, contextAwareEventLoop, current, invokeOnEnterCallbacks, invokeOnExitCallbacks, localAddress, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, mapCurrent, method, onEnter, onExit, path, push, push, rejectPromise, remoteAddress, request, resolvePromise, sessionProtocol
public DefaultServiceRequestContext(ServiceConfig cfg, io.netty.channel.Channel ch, SessionProtocol sessionProtocol, java.lang.String method, java.lang.String path, java.lang.String mappedPath, java.lang.Object request, @Nullable javax.net.ssl.SSLSession sslSession)
ch
- the Channel
that handles the invocationsessionProtocol
- the SessionProtocol
of the invocationrequest
- the request associated with this contextsslSession
- the SSLSession
for this invocation if it is over TLSprotected io.netty.channel.Channel channel()
NonWrappingRequestContext
Channel
that is handling this request, or null
if the connection is not
established yet.channel
in class NonWrappingRequestContext
public Server server()
ServiceRequestContext
server
in interface ServiceRequestContext
public VirtualHost virtualHost()
ServiceRequestContext
VirtualHost
that is handling the current Request
.virtualHost
in interface ServiceRequestContext
public PathMapping pathMapping()
ServiceRequestContext
pathMapping
in interface ServiceRequestContext
public <T extends Service<?,?>> T service()
ServiceRequestContext
service
in interface ServiceRequestContext
public java.util.concurrent.ExecutorService blockingTaskExecutor()
ServiceRequestContext
ExecutorService
that could be used for executing a potentially long-running task.
The ExecutorService
will propagate the ServiceRequestContext
automatically when running
a task.
Note that performing a long-running task in Service.serve(ServiceRequestContext, Request)
may block the Server
's I/O event loop and thus should be executed in other threads.
blockingTaskExecutor
in interface ServiceRequestContext
public io.netty.channel.EventLoop eventLoop()
RequestContext
EventLoop
that is handling the current Request
.eventLoop
in interface RequestContext
public java.lang.String mappedPath()
ServiceRequestContext
RequestContext.path()
.mappedPath
in interface ServiceRequestContext
public org.slf4j.Logger logger()
logger
in interface ServiceRequestContext
@Nullable public javax.net.ssl.SSLSession sslSession()
RequestContext
SSLSession
for this request if the connection is made over TLS, or null
if
the connection is not established yet or the connection is not a TLS connection.sslSession
in interface RequestContext
sslSession
in class NonWrappingRequestContext
public long requestTimeoutMillis()
ServiceRequestContext
Request
completely.
This value is initially set from ServerConfig.defaultRequestTimeoutMillis()
.requestTimeoutMillis
in interface ServiceRequestContext
public void setRequestTimeoutMillis(long requestTimeoutMillis)
ServiceRequestContext
Request
completely.
This value is initially set from ServerConfig.defaultRequestTimeoutMillis()
.setRequestTimeoutMillis
in interface ServiceRequestContext
public void setRequestTimeout(java.time.Duration requestTimeout)
ServiceRequestContext
Request
completely.
This value is initially set from ServerConfig.defaultRequestTimeoutMillis()
.setRequestTimeout
in interface ServiceRequestContext
public long maxRequestLength()
ServiceRequestContext
Request
.
This value is initially set from ServerConfig.defaultMaxRequestLength()
.maxRequestLength
in interface ServiceRequestContext
ContentTooLargeException
public void setMaxRequestLength(long maxRequestLength)
ServiceRequestContext
Request
.
This value is initially set from ServerConfig.defaultMaxRequestLength()
.setMaxRequestLength
in interface ServiceRequestContext
ContentTooLargeException
public RequestLog log()
RequestContext
RequestLog
that contains the information about the current Request
.log
in interface RequestContext
public RequestLogBuilder logBuilder()
RequestContext
RequestLogBuilder
that collects the information about the current Request
.logBuilder
in interface RequestContext
public void setRequestTimeoutChangeListener(RequestTimeoutChangeListener listener)
Note: This method is meant for internal use by server-side protocol implementation to reschedule a timeout task when a user updates the request timeout configuration.
public java.lang.String toString()
toString
in class java.lang.Object