Using a filter without WebapplicationContext?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Using a filter without WebapplicationContext?

Pascal Mainini
Hello all!

Excuse me, if this has been asked before - I'm not subscribed to the list and
I didn't find anything in the archives at

I'm using a Jetty-server embedded in my application, running some servlets.
I want now to be able to use Filters, but i didn't find a way to register them.
The only references I found on this Subject tell about using

My code looks like this:

Server myJetty;

myJetty = new Server();
SocketListener listener = new SocketListener();

ServletHttpContext context = (ServletHttpContext) myJetty.getContext("/");

context.addServlet("/servlet1/*", "org.mydomain.myservlet1");

ServletHolder holder = context.addServlet("/servlet1/*",
holder.put("param1", value1);
holder.put("param2", value2);


Is it possible to add a Filter when using jetty like this? If not, how
can I setup and initialise the servlets and the filters programatically?
I can't deploy them as usual over a WebApplication.

Thanks for your replies in advance!
Please put me directly in cc when replying, thanks!

Kind regards,


This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more.
Jetty-support mailing list
[hidden email]