Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » javax.servlet.Filter in web.xml
javax.servlet.Filter in web.xml [message #75588] Wed, 25 October 2006 17:54 Go to next message
Eclipse UserFriend
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] Thu, 26 October 2006 01:49 Go to previous message
Eclipse UserFriend
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
Previous Topic:Custome Ext or OSGI service
Next Topic:Debug option listeners
Goto Forum:
  


Current Time: Thu Apr 25 13:27:27 GMT 2024

Powered by FUDForum. Page generated in 0.02698 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top