Servlet filter: Difference between revisions

From RavenWiki
Jump to navigationJump to search
No edit summary
(Add link to the github project)
Line 7: Line 7:
: 3. The way status codes are passed back to the Servlet container.  Using the filter, you can now configure the error pages for each status code in the web.xml.  The Valve code could easily be changed to do this too - it currently passed back a 500 for every error.
: 3. The way status codes are passed back to the Servlet container.  Using the filter, you can now configure the error pages for each status code in the web.xml.  The Valve code could easily be changed to do this too - it currently passed back a 500 for every error.


It is available as [http://raven.cam.ac.uk/project/java-toolkit/files/RavenFilter.java Java source] together with a copy of the associated [http://raven.cam.ac.uk/project/java-toolkit/files/RavenFilter.html JavaDoc documentation].
It is available as [http://raven.cam.ac.uk/project/java-toolkit/files/RavenFilter.java Java source] together with a copy of the associated [http://raven.cam.ac.uk/project/java-toolkit/files/RavenFilter.html JavaDoc documentation]. It is also included in the [https://github.com/ucam-cl-dtg/ucam-webauth ucam-webauth github project]


The filter is distributed under the terms of the GNU Lesser General Public License.
The filter is distributed under the terms of the GNU Lesser General Public License.


See also [http://raven.cam.ac.uk/project/java-toolkit/ Java Toolkit], [[Tomcat Valve]], [[Tomcat authenticator and JAAS implementation]] and [[JAVA Servlet Library]].
See also [http://raven.cam.ac.uk/project/java-toolkit/ Java Toolkit], [[Tomcat Valve]], [[Tomcat authenticator and JAAS implementation]] and [[JAVA Servlet Library]].

Revision as of 11:08, 20 June 2012

Philip Shore ( pms52 at cam.ac.uk) has adapted William Billingsley's Tomcat Valve into a servlet filter which can therefore be used with any servlet container - i.e. not just Tomcat. He writes:

I have taken the Valve code and pretty much used it as is. There are three differences:
1. Configuration is simplified.
2. Where the authenticated user name is fetched from. I have had to use a plain session attribute.
3. The way status codes are passed back to the Servlet container. Using the filter, you can now configure the error pages for each status code in the web.xml. The Valve code could easily be changed to do this too - it currently passed back a 500 for every error.

It is available as Java source together with a copy of the associated JavaDoc documentation. It is also included in the ucam-webauth github project

The filter is distributed under the terms of the GNU Lesser General Public License.

See also Java Toolkit, Tomcat Valve, Tomcat authenticator and JAAS implementation and JAVA Servlet Library.