Class UifControllerHandlerInterceptor

java.lang.Object
org.kuali.rice.krad.web.controller.UifControllerHandlerInterceptor
All Implemented Interfaces:
org.springframework.web.servlet.HandlerInterceptor

public class UifControllerHandlerInterceptor extends Object implements org.springframework.web.servlet.HandlerInterceptor
Spring controller intercepter for KRAD controllers.

Provides infrastructure for preparing the form and view before and after the controller is invoked. Included in this is form session management and preparation of the view for rendering

Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterCompletion(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex)
    After the view is rendered remove the view to reduce the size of the form storage in memory.
    protected boolean
    checkForMethodAccess(javax.servlet.http.HttpServletRequest request)
    Checks whether access to the handler method is allowed based available methods or accessible methods on view configuration.
    protected void
    checkHandlerMethodAccess(javax.servlet.http.HttpServletRequest request, Object handler)
    Checks whether access is allowed for the requested controller method.
    protected void
    createUifFormManagerIfNecessary(javax.servlet.http.HttpServletRequest request)
    Checks if a form manager is present in the session, and if not creates a form manager and adds to the session and global variables.
     
    void
    postHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView)
    After the controller logic is executed, the form is placed into session and the corresponding view is prepared for rendering.
    boolean
    preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler)
    Before the controller executes the user session is set on GlobalVariables and messages are cleared, in addition setup for the history manager and a check on missing session forms is performed.
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UifControllerHandlerInterceptor

      public UifControllerHandlerInterceptor()
  • Method Details

    • preHandle

      public boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler) throws Exception
      Before the controller executes the user session is set on GlobalVariables and messages are cleared, in addition setup for the history manager and a check on missing session forms is performed.
      Specified by:
      preHandle in interface org.springframework.web.servlet.HandlerInterceptor
      Throws:
      Exception
    • checkHandlerMethodAccess

      protected void checkHandlerMethodAccess(javax.servlet.http.HttpServletRequest request, Object handler) throws Exception
      Checks whether access is allowed for the requested controller method.

      First a check is done on the method to determine whether it contains the annotation MethodAccessible. If so, access is allowed. If the annotation is not present, data from the posted view (if any) is referenced to determine whether the method was configured as an accessible method to call.

      If method access is not allowed, a MethodAccessException is thrown.

      Parameters:
      request - HTTP request (used to retrieve parameters)
      handler - handler method that was determined based on the request and mappings
      Throws:
      Exception
    • checkForMethodAccess

      protected boolean checkForMethodAccess(javax.servlet.http.HttpServletRequest request)
      Checks whether access to the handler method is allowed based available methods or accessible methods on view configuration.

      Since this method is invoked before the request form is setup, we need to retrieve the session form form the form manager. In the case of missing post data (GET requests), view method access is not granted.

      Parameters:
      request - HTTP request to retrieve parameters from
      Returns:
      boolean true if method access is allowed based on the view, false if not
    • createUifFormManagerIfNecessary

      protected void createUifFormManagerIfNecessary(javax.servlet.http.HttpServletRequest request)
      Checks if a form manager is present in the session, and if not creates a form manager and adds to the session and global variables.
      Parameters:
      request - http request being handled
    • postHandle

      public void postHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView) throws Exception
      After the controller logic is executed, the form is placed into session and the corresponding view is prepared for rendering.
      Specified by:
      postHandle in interface org.springframework.web.servlet.HandlerInterceptor
      Throws:
      Exception
    • afterCompletion

      public void afterCompletion(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex) throws Exception
      After the view is rendered remove the view to reduce the size of the form storage in memory.
      Specified by:
      afterCompletion in interface org.springframework.web.servlet.HandlerInterceptor
      Throws:
      Exception
    • getModelAndViewService

      protected ModelAndViewService getModelAndViewService()
    • setModelAndViewService

      public void setModelAndViewService(ModelAndViewService modelAndViewService)