public abstract class RequestHandlerBase extends org.osgl.Lang.F1<ActionContext,Void> implements RequestHandler
Destroyable.Util
Modifier and Type | Field and Description |
---|---|
protected org.osgl.logging.Logger |
logger |
Constructor and Description |
---|
RequestHandlerBase() |
Modifier and Type | Method and Description |
---|---|
Void |
apply(ActionContext context) |
String |
contentSecurityPolicy()
Get
Content-Security-Policy that applied to this request handler |
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
|
void |
destroy() |
boolean |
disableContentSecurityPolicy() |
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.
|
boolean |
isDestroyed() |
RequestHandlerBase |
noContextResoving() |
RequestHandler |
realHandler() |
protected void |
releaseResources() |
boolean |
requireResolveContext()
Returns if the handler require framework to resolve context.
|
Class<? extends Annotation> |
scope() |
boolean |
sessionFree()
Returns if the handler is session free or not.
|
RequestHandlerBase |
setExpress() |
RequestHandlerBase |
setSessionFree() |
boolean |
skipEvents(ActionContext context)
By default an
express handler will skip result commit events triggering. |
boolean |
supportPartialPath()
Indicate if this request handler support partial path lookup.
|
String |
toString() |
static RequestHandlerBase |
wrap(SimpleRequestHandler handler) |
andThen, andThen, applyOrElse, compose, compose, compose, compose, compose, compose, curry, invert, lift, orElse, times
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
handle, prepareAuthentication
public final Void apply(ActionContext context) throws org.osgl.exception.NotAppliedException, org.osgl.Lang.Break
apply
in interface org.osgl.Lang.Function<ActionContext,Void>
org.osgl.exception.NotAppliedException
org.osgl.Lang.Break
public RequestHandlerBase setExpress()
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
context
- the action contexttrue
if this handler support direct io thread processingpublic boolean skipEvents(ActionContext context)
By default an express
handler will skip result commit events triggering.
skipEvents
in interface RequestHandler
context
- the action context.express(ActionContext)
public final Class<? extends Annotation> scope()
scope
in interface Destroyable
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
true
if the request handler support partial path lookup or false
otherwisepublic 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
public RequestHandlerBase noContextResoving()
public RequestHandler realHandler()
public RequestHandlerBase setSessionFree()
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
true
if the handler is session freepublic CORS.Spec corsSpec()
RequestHandler
Get CORS specification that specifically applied to this request handler
corsSpec
in interface RequestHandler
public CSRF.Spec csrfSpec()
RequestHandler
Get CSRF specification that applied to this request handler
csrfSpec
in interface RequestHandler
public String contentSecurityPolicy()
RequestHandler
Get Content-Security-Policy
that applied to this request handler
contentSecurityPolicy
in interface RequestHandler
Content-Security-Policy
that applied to this request handlerpublic boolean disableContentSecurityPolicy()
disableContentSecurityPolicy
in interface RequestHandler
public void destroy()
destroy
in interface Destroyable
public boolean isDestroyed()
isDestroyed
in interface Destroyable
protected void releaseResources()
public static RequestHandlerBase wrap(SimpleRequestHandler handler)
Copyright © 2014–2021 ActFramework. All rights reserved.