• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

forward to different context

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was not aware of this.
We can 'forward' request to the resources present in other context/application...
Will it work even if both applications are not on same server???


You can not use a jsp:forward between two different servler contexts. You can use a RequestDispatcher forward between two different contexts (at least on tomcat)

1: enable cross context capability in the context config file for both contextts.
2: get a reference to the other context using ServletContext.getContext("name")
3: get the RequestDispatcher for the other context using the context object from step 2
4: do the forward

All of this logic could be coded into a custom tag.



From: http://forum.java.sun.com/thread.jspa?threadID=593250&messageID=3109439
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Will it work even if both applications are not on same server???


No, you'll have to redirect.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ankur,

Just be aware that you verify that this works in your production environment which usually have highly restrictive security settings. You need to watch if your application shares the app server with other applications

Just a thought !
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vivek Pandey:
Hi Ankur,

Just be aware that you verify that this works in your production environment which usually have highly restrictive security settings. You need to watch if your application shares the app server with other applications

Just a thought !



Thanks Satou and Vivek.
I was also thinking that this can be a feature of tomcat or any other web/application server but we shouldn't consider this a possiblility, I mean Sun didn't mean to provide this... just thinking, not sure.
 
Check your pockets for water buffalo. You might need to use this tiny ad until locate a water buffalo:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic