About Web Server Utilities

Web server utilities for Java EE, servlet containers, etc. This currently provides support for HTTP filters, HTTP header parsing and content negotiation. This project servers as the parent to severals modules that provide these features.

Project Modules

This project has declared the following modules:

Name Description
Filter Utilities Provides basic support of servlet filter. Boilerplate code etc. It provides a boilerplate implementation of the Filter interface. The GenericFilter provides a getter and setter for the FilterConfig object and ensures that this is set when init is called. The init method also calls the configureFilter method after the FilterConfig object is set and can be used by subclasses to process the filter config during initiation. It also provides an empty implementation of the destory method. The only method that requires implementation is the doFilter method. The GenericHTTPFilter extends the GenericFilter class, it provides a doFilter method that attempts to cast the ServletRequest and ServletResponse objects to HttpServletRequest and HttpServletResponse objects. If these objects can be cast successfuly then it calls the doHTTPFilter method and passes the cast objects references. If the objects cannot be cast a ServletException is thrown. The doHTTPFilter method is abstract and must be implemented by subclasses.
Structured HTTP Headers Allows HTTP headers to be represented in a structured way. The parsers for each header field are represented as separate classes implementing the 'com.mattunderscore.http.headers.HeaderParser' interface. The values of each header field are represented as separate classes implementing the 'com.mattunderscore.http.headers.HeaderFieldElement' interface. Where a header field has a list of values each of these values is represented as a separate object of the same class. When these values are qualified the class implements the 'com.mattunderscore.http.headers.Qualified' interface.
Content Negotiation Filter This Content Negotiation Filter provides a content negotiation filter for Java EE servlet containers. The content negotiation algorithm is based on the Apache negotiation algorithm but lacks support for the encoding and character set. The variants can be configured through an XML file, negotiation.xml, in the WEB-INF/classes directory. This file can be overriden with the 'xmlInputFile' filter parameter. This XML file is parsed with the class 'com.mattunderscore.filter.contentnegotiation.variantsource.FilterVariantXMLSource'. This class can be overridden with the 'variantSource' filter parameter. The XML parser is implemented as a SAX parser. The SAX handler class can be overridden by the saxHandlerClass filter parameter. The 'variantSource' parameter can take any class that implements the 'com.mattunderscore.filter.contentnegotiation.variantsource.VariantSource'.