public class DelegateRequestHandler extends RequestHandlerBase
Base class to implement handler delegation chain
Destroyable.Util
Modifier and Type | Field and Description |
---|---|
protected RequestHandler |
handler_ |
logger
Modifier | Constructor and Description |
---|---|
protected |
DelegateRequestHandler(RequestHandler handler) |
Modifier and Type | Method and Description |
---|---|
CORS.Spec |
corsSpec()
Get CORS specification that specifically applied to this request handler
|
CSRF.Spec |
csrfSpec()
Get CSRF specification that applied to this request handler
|
boolean |
express(ActionContext context)
Indicate the handler logic is fast enough to be put into network layer’s io thread and does not require to dispatch to worker thread.
|
void |
handle(ActionContext context)
Invoke handler upon an action context
|
protected RequestHandler |
handler() |
void |
prepareAuthentication(ActionContext context)
Setting up handler for authentication.
|
RequestHandler |
realHandler() |
protected void |
releaseResources() |
boolean |
requireResolveContext()
Returns if the handler require framework to resolve context.
|
boolean |
sessionFree()
Returns if the handler is session free or not.
|
boolean |
supportPartialPath()
Indicate if this request handler support partial path lookup.
|
java.lang.String |
toString() |
apply, destroy, isDestroyed, noContextResoving, scope, setExpress, setSessionFree, wrap
protected RequestHandler handler_
protected DelegateRequestHandler(RequestHandler handler)
public boolean express(ActionContext context)
RequestHandler
Indicate the handler logic is fast enough to be put into network layer’s io thread and does not require to dispatch to worker thread.
Note a handler that implements ExpressHandler
should always return true
for this method
express
in interface RequestHandler
express
in class RequestHandlerBase
context
- the action contexttrue
if this handler support direct io thread processingpublic void handle(ActionContext context)
RequestHandler
Invoke handler upon an action context
context
- the context datapublic boolean requireResolveContext()
RequestHandler
Returns if the handler require framework to resolve context. Usually it needs to resolve the context so that handler can access request params, session/flash etc. However some static handlers doesn’t require framework to do those things, e.g. FileGetter
requireResolveContext
in interface RequestHandler
requireResolveContext
in class RequestHandlerBase
public boolean supportPartialPath()
RequestHandler
Indicate if this request handler support partial path lookup. Usually this method should return false
. However for certain request handler like FileGetter
they need to support partial path lookup. Take the example of the following route mapping:
GET /public staticDir: /public
which map url path /public
to a StaticFileGetter
with base dir set to /public
, it needs to support all path starts with “/public”, like “/public/js/jquery.js” etc.supportPartialPath
in interface RequestHandler
supportPartialPath
in class RequestHandlerBase
true
if the request handler support partial path lookup or false
otherwiseprotected RequestHandler handler()
public CORS.Spec corsSpec()
RequestHandler
Get CORS specification that specifically applied to this request handler
corsSpec
in interface RequestHandler
corsSpec
in class RequestHandlerBase
public CSRF.Spec csrfSpec()
RequestHandler
Get CSRF specification that applied to this request handler
csrfSpec
in interface RequestHandler
csrfSpec
in class RequestHandlerBase
public boolean sessionFree()
RequestHandler
Returns if the handler is session free or not. If a handler is session free then the framework will NOT resolve session
sessionFree
in interface RequestHandler
sessionFree
in class RequestHandlerBase
true
if the handler is session freepublic void prepareAuthentication(ActionContext context)
RequestHandler
Setting up handler for authentication. For example, initialize the missing authentication handler, csrf failure handler.
context
- the current action contextpublic RequestHandler realHandler()
realHandler
in class RequestHandlerBase
protected void releaseResources()
releaseResources
in class RequestHandlerBase
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014–2017 ActFramework. All rights reserved.