more on servlet filters...

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

more on servlet filters...

sent2null@netzero.com
Since my last letter I've done some more investigating of the API and combined with google searches was able to cobble together the following code.

********************code below

...
initialize server, get context
...


 System.out.println("just before defining authorization filter code block, http context.");
             //Instantiate a new webapplicationhandler
   WebApplicationHandler whandler = new WebApplicationHandler();
             //Instantiate a filter holder
             FilterHolder fholder = whandler.defineFilter("authfilter",AuthorizationFilter.class.getName());
             //add the filterholder to the webapp handler after defining it for the authorization filter.
             whandler.addFilterHolder(fholder);
             //Map context path to the filter
             whandler.addFilterPathMapping(cono.getVirtualPath(),"authfilter",Dispatcher.__REQUEST);
             //add the webapphandler to the existing server context
             context.addHandler(whandler);
              System.out.println("just after adding authorization filter handler to context, http context.");

...
define servlet handler, add servlets, define resource handler, start server
...
           
*****************code above

The code compiles fine, however the Filter is apparently not being called on the requests as standard out trace calls placed in the "doFilter()" are never triggered. Is there yet another initialization/configuration call that I need to have in that block to make it work? Is there a problem with adding the ServletHandler and Resource handlers after the WebContextHandler to the context? I am hoping I am just missing some call somewhere (it took me long enough to figure out the whole defineFilter/Dispatch idea!)

Any help that can be provided would be greatly appreciated.

Regards,

David



______________________________________________________________________
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