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, timesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithandle, prepareAuthenticationpublic 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.NotAppliedExceptionorg.osgl.Lang.Breakpublic RequestHandlerBase setExpress()
public boolean express(ActionContext context)
RequestHandlerIndicate 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 RequestHandlercontext - 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 RequestHandlercontext - the action context.express(ActionContext)public final Class<? extends Annotation> scope()
scope in interface Destroyablepublic boolean supportPartialPath()
RequestHandlerIndicate 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 RequestHandlertrue if the request handler support partial path lookup or false otherwisepublic boolean requireResolveContext()
RequestHandlerReturns 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 RequestHandlerpublic RequestHandlerBase noContextResoving()
public RequestHandler realHandler()
public RequestHandlerBase setSessionFree()
public boolean sessionFree()
RequestHandlerReturns if the handler is session free or not. If a handler is session free then the framework will NOT resolve session
sessionFree in interface RequestHandlertrue if the handler is session freepublic CORS.Spec corsSpec()
RequestHandlerGet CORS specification that specifically applied to this request handler
corsSpec in interface RequestHandlerpublic CSRF.Spec csrfSpec()
RequestHandlerGet CSRF specification that applied to this request handler
csrfSpec in interface RequestHandlerpublic String contentSecurityPolicy()
RequestHandlerGet Content-Security-Policy that applied to this request handler
contentSecurityPolicy in interface RequestHandlerContent-Security-Policy that applied to this request handlerpublic boolean disableContentSecurityPolicy()
disableContentSecurityPolicy in interface RequestHandlerpublic void destroy()
destroy in interface Destroyablepublic boolean isDestroyed()
isDestroyed in interface Destroyableprotected void releaseResources()
public static RequestHandlerBase wrap(SimpleRequestHandler handler)
Copyright © 2014–2018 ActFramework. All rights reserved.