Generic postprocessor ver. 1.5


This is a Java servlet filter (as per Servlet API 2.3). This filter lets you post process incoming requests right in JSP pages. So each incoming request will be forwarded after the standard processing to some JSP page (provided as a parameter for this filter). This JSP will play a role of postprocessor.

How to use it:

a) download generic1flt.jar and save it in WEB-INF/lib

b) describe this filter in web.xml. Initial parameter postprocessor describes your JSP page for post processing. An optional attribute oncePerSession lets you invoke postprocessing once per session.
 


<filter>
  <filter-name>Generic1Filter</filter-name>
  <filter-class>com.cj.generic1flt.Generic1Filter</filter-class>
  <init-param>
   <param-name>postprocessor</param-name>
   <param-value>your_page.jsp</param-value>
  </init-param>
  <init-param>
   <param-name>oncePerSession</param-name>
   <param-value>true</param-value>
  </init-param>
</filter>

c) describe a mapping for this filter in web.xml. E.g.:
 


<filter-mapping>
  <filter-name>Generic1Filter</filter-name>
  <url-pattern>*.jsp</url-pattern>
</filter-mapping>

in this case filter will be on for each your .jsp file

And now when you invoke any .jsp page: http://your_host/your_page.jsp this page will be processed as it is and control will be passed after that to your JSP page provided as an initial parameter for Generic1Filter. This page is a normal JSP page where you can do whatever you need with outgoing requests. As soon as your post processing will be completed the normal chain for your request will be restored.

In your JSP postprocessor you may use Postprocessor taglib for getting the original URI, generated output and terminating request's chain.

   For downloading:
    Filter:  generic1flt.jar

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

     

Also in JSOS: