File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes servlet chaining Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet chaining" Watch "servlet chaining" New topic
Author

servlet chaining

tcspillai
Greenhorn

Joined: Jun 04, 2001
Posts: 2
can anyone tell me the exact purpose of using servlet chaining
probably with an example???
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
Servlet chaining was a way of passing the response from one servlet to another servlet as part of the request (as I understand it). I think this was never part of the official API, but something added by some vendors.
The latest API 2.3 has "Filters" which provide a formal method of specifying a filter that looks at and may modify a request before sending it on to a servlet, also the same thing on the output end. As it happens, I am just now reading the comments on Filters in the Tomcat 4.0 distribution:
"You can now register Filters in the web.xml file that are the application level analogue to Valves in the Catalina core. Filters have the following general features:
- Filters can be mapped to either URL patterns or particular servlets
- Filters can pre-process and post-process requests and responses
- Filters can wrap the request and/or response objects that are passed on
(so you can do content type transformations, for example)
- Filters can respond to a request and return, instead of passing the request on (for example, you can do authentication challenges at the app level)
Related to this, servlets can now do the same sort of wrapping when they pass arguments to a RequestDispatcher. Previously, you were required to pass the original request and response objects received from the container.
"
Some uses that occur to me:
Encryption/decryption
Transformation of XML output of a servlet by a filter using a selected XSL transform.
Bill

------------------
author of:
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"tcspillai",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: servlet chaining