Interface RequestInterceptor

  • All Superinterfaces:
    EntityProvider

    public interface RequestInterceptor
    extends EntityProvider
    Allows actions to be taken before a direct request is handled or after it has been handled, will only affect requests coming in via the direct servlet
    Author:
    Aaron Zeckoski (aaron@caret.cam.ac.uk)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void after​(EntityView view, HttpServletRequest req, HttpServletResponse res)
      Take actions after the request is handled for an entity view, this will be called just before each response is sent back to the requester, normally this would be used to add something to the response as it is getting ready to be sent back to the requester
      void before​(EntityView view, HttpServletRequest req, HttpServletResponse res)
      Take actions before the request is handled for an entity view, this will be called just before each request is sent to the correct request handler, this might be used to add information to the response before it goes on to be handled or to take some action as a result of information in the request or reference,
      if you want to interrupt the handling of this request (stop it) then throw an EntityException and include the type of response you would like to return in the exception (this can be a success or failure response status)
    • Method Detail

      • before

        void before​(EntityView view,
                    HttpServletRequest req,
                    HttpServletResponse res)
        Take actions before the request is handled for an entity view, this will be called just before each request is sent to the correct request handler, this might be used to add information to the response before it goes on to be handled or to take some action as a result of information in the request or reference,
        if you want to interrupt the handling of this request (stop it) then throw an EntityException and include the type of response you would like to return in the exception (this can be a success or failure response status)
        Parameters:
        view - an entity view, should contain all the information related to the incoming entity URL
        req - the servlet request (available in case you need to get anything out of it)
        res - the servlet response, put the correct data response into the outputstream
      • after

        void after​(EntityView view,
                   HttpServletRequest req,
                   HttpServletResponse res)
        Take actions after the request is handled for an entity view, this will be called just before each response is sent back to the requester, normally this would be used to add something to the response as it is getting ready to be sent back to the requester
        Parameters:
        view - an entity view, should contain all the information related to the incoming entity URL
        req - the servlet request (available in case you need to get anything out of it)
        res - the servlet response, put the correct data response into the outputstream