javax.servlet.Filter in web.xml [message #75588] |
Wed, 25 October 2006 13:54  |
Eclipse User |
|
|
|
Originally posted by: ridcully560.yahoo.com
Hello,
in the application that I'm working on, there's an javax.servlet.Filter
class defined and mapped to a servlet (in the web.xml):
> <servlet>
> <servlet-name>MainServlet</servlet-name>
> <servlet-class>package.control.MainServlet</servlet-class>
> </servlet>
> <filter>
> <filter-name>MigrationFilter</filter-name>
> <filter-class>package.migration.MigrationFilter</filter-class >
> </filter>
> <filter-mapping>
> <filter-name>MigrationFilter</filter-name>
> <servlet-name>MainServlet</servlet-name>
> </filter-mapping>
The web.xml-file is located in Project/WebContent/WEB-INF/web.xml. I am
registering the whole WebContent-directory as a recource in the
plugin.xml (working with the JSPs in that directory (and subdirectoies)
works fine, so that recource-definition should work right).
At the moment I'm running it all with the jetty-bundle under eclipse.
How can I get that filter to work correctly?
Johannes
|
|
|
Re: javax.servlet.Filter in web.xml [message #75660 is a reply to message #75588] |
Wed, 25 October 2006 21:49  |
Eclipse User |
|
|
|
Originally posted by: skaegi.sympatico.ca
Hi Johannes,
The OSGi Http Service does not provide direct support for filters.
That said, if you can get over the method name, the HttpContext has a
"handleSecurity" method that can act in much the same way as a filter.
For the time being I'd suggest using this approach.
--
I've been experimenting with a FilterChainServletAdaptor
e.g.
FilterChainServletAdaptor chainServlet = new FilterChainServletAdaptor(new
MainServlet());
chainServlet.add(new MigrationFilter(), filterparams);
chainServlet.add(new AnotherMigrationFilter(), otherfilterparams);
....
httpService.registerServlet("/servlet", chainServlet, servletParams,
myHttpContext);
It looks pretty complex, but it actually works pretty well.
When I have a little more confidence in it I'll post it here --
https://bugs.eclipse.org/bugs/show_bug.cgi?id=128068
--
HTH
-Simon
"Johannes" <ridcully560@yahoo.com> wrote in message
news:eho8a8$jcv$1@utils.eclipse.org...
> Hello,
>
> in the application that I'm working on, there's an javax.servlet.Filter
> class defined and mapped to a servlet (in the web.xml):
>
> > <servlet>
> > <servlet-name>MainServlet</servlet-name>
> > <servlet-class>package.control.MainServlet</servlet-class>
> > </servlet>
> > <filter>
> > <filter-name>MigrationFilter</filter-name>
> > <filter-class>package.migration.MigrationFilter</filter-class >
> > </filter>
> > <filter-mapping>
> > <filter-name>MigrationFilter</filter-name>
> > <servlet-name>MainServlet</servlet-name>
> > </filter-mapping>
>
> The web.xml-file is located in Project/WebContent/WEB-INF/web.xml. I am
> registering the whole WebContent-directory as a recource in the
> plugin.xml (working with the JSPs in that directory (and subdirectoies)
> works fine, so that recource-definition should work right).
>
> At the moment I'm running it all with the jetty-bundle under eclipse.
>
> How can I get that filter to work correctly?
>
> Johannes
|
|
|
Powered by
FUDForum. Page generated in 0.03693 seconds