Package org.kohsuke.stapler
Interface DispatchValidator
-
public interface DispatchValidator
Validates dispatch requests. This validator is configured throughWebApp.setDispatchValidator(DispatchValidator)
and is automatically used by dispatchers created throughFacet.createValidatingDispatcher(AbstractTearOff, ScriptExecutor)
. Extends facet dispatchers to provide validation of views before they dispatch, thus allowing a final veto before dispatch begins writing any response body to the client.- Since:
- TODO
- See Also:
WebApp.setDispatchValidator(DispatchValidator)
-
-
Field Summary
Fields Modifier and Type Field Description static DispatchValidator
DEFAULT
Default validator implementation that explicitly allows all dispatch requests to proceed.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
allowDispatch(StaplerRequest req, StaplerResponse rsp)
Allows the given request to be dispatched.Boolean
isDispatchAllowed(StaplerRequest req, StaplerResponse rsp)
Checks if the given request and response should be allowed to dispatch.default Boolean
isDispatchAllowed(StaplerRequest req, StaplerResponse rsp, String viewName, Object node)
Checks if the given request and response should be allowed to dispatch a view on an optionally present node object.default void
requireDispatchAllowed(StaplerRequest req, StaplerResponse rsp)
Throws aCancelRequestHandlingException
if the given request is not allowed.
-
-
-
Field Detail
-
DEFAULT
static final DispatchValidator DEFAULT
Default validator implementation that explicitly allows all dispatch requests to proceed.
-
-
Method Detail
-
isDispatchAllowed
@CheckForNull Boolean isDispatchAllowed(@NonNull StaplerRequest req, @NonNull StaplerResponse rsp)
Checks if the given request and response should be allowed to dispatch. Returnsnull
to indicate an unknown or neutral result.- Parameters:
req
- the HTTP request to validatersp
- the HTTP response- Returns:
- true if the request should be dispatched, false if not, or null if unknown or neutral
-
isDispatchAllowed
@CheckForNull default Boolean isDispatchAllowed(@NonNull StaplerRequest req, @NonNull StaplerResponse rsp, @NonNull String viewName, @CheckForNull Object node)
Checks if the given request and response should be allowed to dispatch a view on an optionally present node object. Returnsnull
to indicate an unknown or neutral result.- Parameters:
req
- the HTTP request to validatersp
- the HTTP responseviewName
- the name of the view to dispatchnode
- the node being dispatched if present- Returns:
- true if the view should be allowed to dispatch, false if it should not, or null if unknown
-
allowDispatch
void allowDispatch(@NonNull StaplerRequest req, @NonNull StaplerResponse rsp)
Allows the given request to be dispatched. Further calls toisDispatchAllowed(StaplerRequest, StaplerResponse)
should return true for the same request.
-
requireDispatchAllowed
default void requireDispatchAllowed(@NonNull StaplerRequest req, @NonNull StaplerResponse rsp) throws CancelRequestHandlingException
Throws aCancelRequestHandlingException
if the given request is not allowed.- Throws:
CancelRequestHandlingException
-
-