mariuss
Jun 12th, 2007, 08:09 PM
I was wondering if there is any dispatcher class for filters, something along the lines of DispatcherServlet?
The idea is to be able to configure a DispatcherFilter which will load an xml bean file based on its name and instantiate filters from there. For example:
<filter>
<filter-name>Master</filter-name>
<filter-class>org.springframework.web.servlet.DispatcherFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Master</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
And the corresponding xml file would be Master-filter.xml
These *-filter.xml files will have to define mappings and controllers similar to *-servlet.xml files. In this case controllers will have to implement javax.servlet.FilterConfig (or some Spring provided base class).
This would allow very flexible configuration of filters.
I know that you can use HandlerInterceptors with DispatcherServlet to achieve similar results, but that assumes that you are going with the Spring MVC all the way. Also, you may want to use third party filters and just need a nice way to configure them (with values from .properties files for example).
What do you think?
Marius
The idea is to be able to configure a DispatcherFilter which will load an xml bean file based on its name and instantiate filters from there. For example:
<filter>
<filter-name>Master</filter-name>
<filter-class>org.springframework.web.servlet.DispatcherFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Master</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
And the corresponding xml file would be Master-filter.xml
These *-filter.xml files will have to define mappings and controllers similar to *-servlet.xml files. In this case controllers will have to implement javax.servlet.FilterConfig (or some Spring provided base class).
This would allow very flexible configuration of filters.
I know that you can use HandlerInterceptors with DispatcherServlet to achieve similar results, but that assumes that you are going with the Spring MVC all the way. Also, you may want to use third party filters and just need a nice way to configure them (with values from .properties files for example).
What do you think?
Marius