Package org.kohsuke.stapler
Class Dispatcher
java.lang.Object
org.kohsuke.stapler.Dispatcher
- Direct Known Subclasses:
HttpDeletable.HttpDeletableDispatcher
Controls the dispatching of incoming HTTP requests.
- Author:
- Kohsuke Kawaguchi
-
Field Summary
Modifier and TypeFieldDescriptionstatic boolean
This flag will activate the evaluation trace.static boolean
This flag will activate the per-request evaluation trace for requests that have X-Stapler-Trace set to "true". -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
anonymizedTraceEval
(StaplerRequest2 req, StaplerResponse2 rsp, Object node, String format, String... args) abstract boolean
dispatch
(RequestImpl req, ResponseImpl rsp, Object node) Tries to handle the given request and returns true if it succeeds.static boolean
Checks if tracing is enabled for the given request.abstract String
toString()
Diagnostic string that explains this dispatch rule.static void
trace
(StaplerRequest2 req, StaplerResponse2 rsp, String msg) static void
trace
(StaplerRequest2 req, StaplerResponse2 rsp, String msg, Object... args) static boolean
static void
traceEval
(StaplerRequest2 req, StaplerResponse2 rsp, Object node) static void
traceEval
(StaplerRequest2 req, StaplerResponse2 rsp, Object node, String expression) static void
traceEval
(StaplerRequest2 req, StaplerResponse2 rsp, Object node, String prefix, String suffix)
-
Field Details
-
TRACE
public static boolean TRACEThis flag will activate the evaluation trace. It adds the evaluation process as HTTP headers, and when the evaluation failed, special diagnostic 404 page will be rendered. Useful for developer assistance. -
TRACE_PER_REQUEST
public static boolean TRACE_PER_REQUESTThis flag will activate the per-request evaluation trace for requests that have X-Stapler-Trace set to "true". It adds the evaluation process as HTTP headers, and when the evaluation failed, special diagnostic 404 page will be rendered. Useful for developer assistance.
-
-
Constructor Details
-
Dispatcher
public Dispatcher()
-
-
Method Details
-
dispatch
public abstract boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, jakarta.servlet.ServletException, IllegalAccessException, InvocationTargetException Tries to handle the given request and returns true if it succeeds. Otherwise false.We have a few known strategies for handling requests (for example, one is to try to treat the request as JSP invocation, another might be try getXXX(), etc) So we use a list of
Dispatcher
and try them one by one until someone returns true.- Throws:
IOException
jakarta.servlet.ServletException
IllegalAccessException
InvocationTargetException
-
toString
Diagnostic string that explains this dispatch rule. -
traceable
public static boolean traceable() -
traceEval
-
anonymizedTraceEval
public static void anonymizedTraceEval(StaplerRequest2 req, StaplerResponse2 rsp, Object node, String format, String... args) -
traceEval
public static void traceEval(StaplerRequest2 req, StaplerResponse2 rsp, Object node, String prefix, String suffix) -
traceEval
public static void traceEval(StaplerRequest2 req, StaplerResponse2 rsp, Object node, String expression) -
trace
-
trace
-
isTraceEnabled
Checks if tracing is enabled for the given request. Tracing can be enabled globally with the "stapler.trace=true" system property. Tracing can be enabled per-request by setting "stapler.trace.per-request=true" and sending an "X-Stapler-Trace" header set to "true" with the request.
-