My question concerning the use of Filters without WebapplicationContext

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

My question concerning the use of Filters without WebapplicationContext

Pascal Mainini
Hello again!

I'm sorry for bringing up the question again - I didn't receive any
answers yet and I was wondering if something about my question
could be wrong. I'm still quite desperate about how to use Filters
in front of servlets added over ServletHttpContext's addServlet-method.
Did I oversee something in the docs? Is this just not possible?

I'm very thankful for all kind of input concerning this question,
thanks in advance.

Here again the code-snippet I use:

---
Server myJetty;

// here goes intialisation of myJetty

ServletHttpContext context = (ServletHttpContext) myJetty.getContext("/");
context.addServlet("/servlet1/*", "org.mydomain.myservlet1");

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

...
---

Thanks a lot!

Pascal



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: My question concerning the use of Filters without WebapplicationContext

Chris Haynes
Filters exist within WebApplicationContext objects - which extend
ServletHttpContext.

So you need something like this:

1) Construct a  WebApplicationContext  rather than a ServletHttpContext
2) Get its WebApplicationHolder
3) Use addFilterPathMapping()

The key to solving problems like this is to cruise around the APIs e.g.
http://jetty.mortbay.org/javadoc/org/mortbay/jetty/servlet/WebApplicationHandler.html
looking for the bits you need.

Chris Haynes


----- Original Message -----
From: "Pascal Mainini" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, October 13, 2005 3:31 PM
Subject: [Jetty-support] My question concerning the use of Filters without
WebapplicationContext


> Hello again!
>
> I'm sorry for bringing up the question again - I didn't receive any
> answers yet and I was wondering if something about my question
> could be wrong. I'm still quite desperate about how to use Filters
> in front of servlets added over ServletHttpContext's addServlet-method.
> Did I oversee something in the docs? Is this just not possible?
>
> I'm very thankful for all kind of input concerning this question,
> thanks in advance.
>
> Here again the code-snippet I use:
>
> ---
> Server myJetty;
>
> // here goes intialisation of myJetty
>
> ServletHttpContext context = (ServletHttpContext) myJetty.getContext("/");
> context.addServlet("/servlet1/*", "org.mydomain.myservlet1");
>
> ServletHolder holder = context.addServlet("/servlet1/*",
>                       "org.mydomain.myservlet1");
> holder.put("param1", value1);
> holder.put("param2", value2);





-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support