aspose file tools*
The moose likes Servlets and the fly likes Accessing input/reader in forwarded servlet 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 "Accessing input/reader in forwarded servlet" Watch "Accessing input/reader in forwarded servlet" New topic
Author

Accessing input/reader in forwarded servlet

D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Looking in servlet spec and do not see an answer. What's is right behavior of container in the following situation:
1. servlet invoked by client and processes a multipart request
2. servlet decides to forward request to another servlet
3. another servlet is capable process muktipart requests as well, so my questions are:
- what is a request method of a forwarded servlet? (An original or PUT?)
- what happens if a forwarded servlet acceesses request input/reader? (Illegal state or EOS?)

I know that a servlet can manage if it called by due forward, but I need answers to provide right container behaivor when serlet doesn't take care of that.

PS it's for 2.4/2.5.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
what is a request method of a forwarded servlet? (An original or PUT?)
- what happens if a forwarded servlet acceesses request input/reader? (Illegal state or EOS?)


1. The request object retains the original method.
2. If the initial servlet read the input stream, the second servlet can not back it up or regenerate it but has to work with the input stream in the condition left by the first. If the first servlet created any objects from the multiparts, they could be attached to the forwarded request.

Bill
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Thanks.

BTW what is relaible way to figure out that servlet forwarded? Check request attribute "javax.servlet.forward.request_uri" ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing input/reader in forwarded servlet