You can reroute the servlet pipeline to include your own servlets that extend the atg.servlet.pipeline.PipelineableServletImpl class. This class implements all Servlet methods, so all you need to do is override the service method. This class defines a property called nextServlet of type Servlet, which specifies the next servlet in the pipeline. When your servlet finishes processing, it passes the request and response objects to the servlet specified by this property, by invoking a method called passRequest.

The following is an example of a pipeline servlet that prints the request URI before passing the request on to the next servlet in the pipeline:

import javax.servlet.*;
import javax.servlet.http.*;
import atg.servlet.*;
import atg.servlet.pipeline.*;

public class URIPrinter extends PipelineableServletImpl {
  public URIPrinter () {}
  public void service (DynamoHttpServletRequest request,
                       DynamoHttpServletResponse response)
       throws IOException, ServletException
    System.out.println ("Handling request for " +
                        request.getRequestURI ());
    passRequest (request, response);

If you want to try out this servlet, you can insert it into the Dynamo request-handling mechanism:

Now when you run Dynamo, it prints out a message for each request before the request is handled by the remaining servlets.

loading table of contents...