Tying in standard Filters to HttpServer instance

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

Tying in standard Filters to HttpServer instance

sent2null@netzero.com
(From previous letter and response)

> 3) Is there any way at all to get access to the session objects associated
with incoming servlet requests handled by the Jetty server? I looked throughout
the API, if it is there I missed it.

[Greg Wilkins wrote:]
>It depends on the context....  while the requests are within the >servlet
handler, you can ask
for the wrapping object.

I am not quite sure what you mean by "ask for the wrapping object", how would this be done. You don't mean by doing a super do you?

My code looks something like this:

********psuedo code below

           // Create the server        
            server = new HttpServer();  

            // set automatic garbage collection periodicity.
            server.setRequestsPerGC(1000);
...
set ssl listeners
...

...
get context from server, set resource path,home,subdirs
...

//Create a servlet container to handle jsp's    
   ServletHandler shandler = new ServletHandler();  

...
add servlets to handler
...

 //add handler to context
 context.addHandler(shandler);
 //Set the resource base.
context.setResourceBase(resourcepath);

...
initialize and add ResourceHandler to context
...

// Start the http server        
 server.start ();

*********end of psuedo code


Now what I am unclear about is where I can add Filters to this code, Once I write my Filter how do I add/associate it with the running Jetty context? I don't see any methods such as "addFilter" in the Handler or Context classes, do classes that implement Filter automatically set a Listener for all incoming requests (and automatically handle them when they come in?) Pardon the inexperience of a complete newbie to Filters.

Any help that can be provided would be greatly appreciated.

Regards,

David




>  But this is more pain than it is really worth.

>Use Jetty 6 or just use standard filters.

Is still missing a few things that I use in the 5.x.x version so I can't use it yet.





______________________________________________________________________
Revolutionize the way you surf the Web!
Try NetZero HiSpeed 3G.
Visit http://www.netzero.com to sign up today!



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

Re: Tying in standard Filters to HttpServer instance

Greg Wilkins-5
[hidden email] wrote:

> Now what I am unclear about is where I can add Filters to this code,
> Once I write my Filter how do I add/associate it with the running Jetty context? I don't see any methods such as "addFilter" in the Handler or Context classes, do classes that implement Filter automatically set a Listener for all incoming requests (and automatically handle them when they come in?) Pardon the inexperience of a complete newbie to Filters.

Filters are configured on the WebApplicationHandler:

http://jetty.mortbay.org/javadoc/org/mortbay/jetty/servlet/WebApplicationHandler.html#addFilterPathMapping(java.lang.String,%20java.lang.String,%20int)


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss