Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing input/reader in forwarded servlet

 
D Rog
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
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" ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic