This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing input/reader in forwarded servlet  RSS feed

 
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

BTW what is relaible way to figure out that servlet forwarded? Check request attribute "javax.servlet.forward.request_uri" ?
 
He was expelled for perverse baking experiments. This tiny ad is a model student:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!