[ajug-members] Spring MVC question

Jeremy J. Grelle Jeremy.Grelle at jdsu.com
Tue Jul 3 07:49:08 EDT 2007


What you are seeing in AbstractController is Spring's typical
application of the template pattern.  You will notice that
handleRequest() is final on AbstractController, so all you actually need
to implement in your subclass is handleRequestInternal(), which is
referred to as the template method.  The handleRequest() implementation
in AbstractController does some basic pre-processing of the request
based on how the properties of the bean are configured.  (See the
javadoc here for the exposed configuration properties:
http://static.springframework.org/spring/docs/2.0.x/api/org/springframew
ork/web/servlet/mvc/AbstractController.html)  

 

Though myself and other AJUG-ers are always more than willing to answer
these sorts of questions, might I suggest you also check out
http://forum.springframework.org <http://forum.springframework.org/> ,
as the core committers hang out there and are usually pretty quick to
answer any such questions.

 

- Jeremy

 

________________________________

From: ajug-members-bounces at ajug.org
[mailto:ajug-members-bounces at ajug.org] On Behalf Of Igor
Tovstopyat-Nelip
Sent: Monday, July 02, 2007 11:44 PM
To: General AJUG membership forum (100-200 messages/month)
Subject: [ajug-members] Spring MVC question

 

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ajug.org/pipermail/ajug-members/attachments/20070703/87425ea4/attachment.html 


More information about the ajug-members mailing list