Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Response.sendRedirect

 
Abhishek Pratap
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi All,

there is one doubt after going through the question of Enthuware.

it says that what is the correct way of sending request paramater to some other servlet residind in same container but different web application.

answer was: response.sendRedirect("String URL").

i dont think so it is correct. can anyone throw some light on it?

regards,
Abhi
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It really depends on the options given but the basic idea behind it is that by default, you can't get a RequestDispatcher for a resource in another web application, it's a security constraint.

To be able to do this, you can usually setup cross-context forwarding for the webapps but by default it's off. So you'll get a null if you try to get the RequestDispatcher for said resource.

In such a case, the only way you can send a request to that resource is to use sendRedirect() since that involves the browser sending a request and not the webapp itself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic