[ajug-members] Spring MVC question

Kerry Wilson kwilson at wmsco.com
Tue Jul 3 07:58:18 EDT 2007


It is my understanding that you do not override handleRequest method 
when extending AbstractController, implement handleRequestInternal.

handleRequest method provides supported method and session 
synchronization functionalities.

source:

  136 	public final ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
  137 			throws Exception {
  138 
  139 		// Delegate to WebContentGenerator for checking and preparing.
  140 		checkAndPrepare(request, response, this instanceof LastModified);
  141 
  142 		// Execute handleRequestInternal in synchronized block if required.
  143 		if (this.synchronizeOnSession) {
  144 			HttpSession session = request.getSession(false);
  145 			if (session != null) {
  146 				Object mutex = WebUtils.getSessionMutex(session);
  147 				synchronized (mutex) {
  148 					return handleRequestInternal(request, response);
  149 				}
  150 			}
  151 		}
  152 
  153 		return handleRequestInternal(request, response);
  154 	}


if you don't need these functionalities just implement controller.

kw



Igor Tovstopyat-Nelip wrote:
> Hi all,
>
> I've got a basic Spring MVC question.
>
> Interface Controller exposes the public method handleRequest() which 
> is supposed to be implemented by any custom controller. This is the 
> main method for Spring MVC from which you hook up to the application 
> service layer.
>
> On another hand, the class AbstractController, which is recommended to 
> use for handling GET type requests, exposes an additional method 
> handleRequestInternal() with exactly the same signature. So, 
> AbstractController and any class derived from it end up with these two 
> methods: handleRequest() and handleRequestInternal().
>
> Why this additional method is needed and why it should be used instead 
> of the normal handleRequest() method?
>
> Thank you,
> Igor
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ajug-members mailing list
> ajug-members at ajug.org
> http://www.ajug.org/mailman/listinfo/ajug-members
>   




More information about the ajug-members mailing list