Package org.kohsuke.stapler
Class Dispatcher
- java.lang.Object
-
- org.kohsuke.stapler.Dispatcher
-
public abstract class Dispatcher extends Object
Controls the dispatching of incoming HTTP requests.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
TRACE
This flag will activate the evaluation trace.static boolean
TRACE_PER_REQUEST
This flag will activate the per-request evaluation trace for requests that have X-Stapler-Trace set to "true".
-
Constructor Summary
Constructors Constructor Description Dispatcher()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static void
anonymizedTraceEval(StaplerRequest req, StaplerResponse 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
isTraceEnabled(StaplerRequest req)
Checks if tracing is enabled for the given request.abstract String
toString()
Diagnostic string that explains this dispatch rule.static void
trace(StaplerRequest req, StaplerResponse rsp, String msg)
static void
trace(StaplerRequest req, StaplerResponse rsp, String msg, Object... args)
static boolean
traceable()
static void
traceEval(StaplerRequest req, StaplerResponse rsp, Object node)
static void
traceEval(StaplerRequest req, StaplerResponse rsp, Object node, String expression)
static void
traceEval(StaplerRequest req, StaplerResponse rsp, Object node, String prefix, String suffix)
-
-
-
Field Detail
-
TRACE
public static boolean TRACE
This 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_REQUEST
This 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.
-
-
Method Detail
-
dispatch
public abstract boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, javax.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
javax.servlet.ServletException
IllegalAccessException
InvocationTargetException
-
toString
public abstract String toString()
Diagnostic string that explains this dispatch rule.
-
traceable
public static boolean traceable()
-
traceEval
public static void traceEval(StaplerRequest req, StaplerResponse rsp, Object node)
-
anonymizedTraceEval
public static void anonymizedTraceEval(StaplerRequest req, StaplerResponse rsp, Object node, String format, String... args)
-
traceEval
public static void traceEval(StaplerRequest req, StaplerResponse rsp, Object node, String prefix, String suffix)
-
traceEval
public static void traceEval(StaplerRequest req, StaplerResponse rsp, Object node, String expression)
-
trace
public static void trace(StaplerRequest req, StaplerResponse rsp, String msg, Object... args)
-
trace
public static void trace(StaplerRequest req, StaplerResponse rsp, String msg)
-
isTraceEnabled
public static boolean isTraceEnabled(StaplerRequest req)
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.
-
-