|
From: Kopylenko, D. <dko...@ac...> - 2004-02-20 13:59:10
|
Cameron, the similar functionality you described is already implemented by Spring's HttpServletBean. Here is the JavaDoc description: Simple extension of javax.servlet.http.HttpServlet that treats its config parameters as bean properties. A very handy superclass for any type of servlet. Type conversion is automatic. It is also possible for subclasses to specify required properties. This servlet leaves request handling to subclasses, inheriting the default behaviour of HttpServlet. This servlet superclass has no dependency on the application context Regards, Dmitriy. -----Original Message----- From: Cameron Braid [mailto:ca...@da...] Sent: Friday, February 20, 2004 1:31 AM To: spr...@li... Subject: [Springframework-developer] Idea for Spring HttpServlet and Filter beans I don't use spring mvc, so this idea may already be implemented. The pattern goes something like this : Have a SpringBeanDelegatingServlet and a SpringBeanDelegatingFilter class that implement HttpServlet and Filter respectively. These classes use init-params to define a named bean to delegate to within spring. Their process methods (process(request,response) or filter(request,response,chain)) delegate to this bean within spring. This allows the beans witin spring to implement HttpServlet or Filter, and to be configured using normal bean configuration like any other bean. I presume that something like this is already integrated into the MVC portion of spring, but I would like to have these two standalone classes to be able to write my own servlets that don't use any other parts of the mcv system. Thanks, Cameron. |