This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Transfer Request from on context to other context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Transfer Request from on context to other context" Watch "Transfer Request from on context to other context" New topic
Author

Transfer Request from on context to other context

Vasantha Prabha
Ranch Hand

Joined: Oct 02, 2003
Posts: 108
Is it possible to transfer a servlet request from one context to other context
If possible can anybody give me the code samples

Regards,
Vasantha


Regards,Vasantha<p>Great minds discuss ideas. Average minds discuss events. Small minds discuss people.
Anthony Watson
Ranch Hand

Joined: Sep 25, 2003
Posts: 327
You can get a reference to another application's ServletContext like this:

this.getServletContext().getContext(uriPath);

Then, you can save an attribute into that context. Just remember, servlet context attributes are not inherently thread safe!

You could also use the above described method but instead of putting a variable into the servlet context, you put the variable into request context, get a RequestDispatcher from the context you got above, and forward the request to another application.
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
You must also enbale "Cross Context" accessibility.

Dan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transfer Request from on context to other context