Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to send values from one Servlet Context to other  RSS feed

 
Vasantha Prabha
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heyy Can any one tell me that How can I send values from one servletContext to other?.
Regards,
Vasantha
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not directly, and for good reasons (mainly security).
There's several indirect ways:
- write a file with the data and check in the other application whether the file is there, if so read and delete.
- send HTTP requests back and forth
- use some other means of network communication
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To switch between web application contexts (in the same container) you need to call getcontext()method of servletcontext. That is -
getServletContext().getContext("\app2").
[ March 22, 2004: Message edited by: Varun Khanna ]
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a security conscious environment, the servlet container may return null for a given URL.

Not guaranteed to work, and in fact I'd recommend any servlet container disabling it by default as it is a potential serious security problem.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!