Interface DispatchValidator


public interface DispatchValidator
Validates dispatch requests. This validator is configured through WebApp.setDispatchValidator(DispatchValidator) and is automatically used by dispatchers created through Facet.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:
  • Field Details

    • DEFAULT

      static final DispatchValidator DEFAULT
      Default validator implementation that explicitly allows all dispatch requests to proceed.
  • Method Details

    • isDispatchAllowed

      @CheckForNull Boolean isDispatchAllowed(@NonNull StaplerRequest2 req, @NonNull StaplerResponse2 rsp)
      Checks if the given request and response should be allowed to dispatch. Returns null to indicate an unknown or neutral result.
      Parameters:
      req - the HTTP request to validate
      rsp - 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 StaplerRequest2 req, @NonNull StaplerResponse2 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. Returns null to indicate an unknown or neutral result.
      Parameters:
      req - the HTTP request to validate
      rsp - the HTTP response
      viewName - the name of the view to dispatch
      node - 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 StaplerRequest2 req, @NonNull StaplerResponse2 rsp)
      Allows the given request to be dispatched. Further calls to isDispatchAllowed(StaplerRequest2, StaplerResponse2) should return true for the same request.
    • requireDispatchAllowed

      default void requireDispatchAllowed(@NonNull StaplerRequest2 req, @NonNull StaplerResponse2 rsp) throws CancelRequestHandlingException
      Throws a CancelRequestHandlingException if the given request is not allowed.
      Throws:
      CancelRequestHandlingException