• 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 a request in distributed application

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to forward a request(which contains a bean) using requestdispatcher to a different server running on other machine.

Loveleen Saroya
(SCJP 1.4)
SCWCD in progress
 
Loveleen Saroya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have to serialize the bean and the request object beside that what else i have to do can u explain with simple code.

Loveleen
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How to forward a request(which contains a bean) using requestdispatcher to a different server running on other machine.



I think you have set the attrribute (bean) in request scope and forwarding it to another resource in the same application in distributed environment. In this case, you can serialize the bean, but not required. The container takes care of it to provide the bean to the right instance where the request is processed.

I don't understand the term "diff server running on other machine". Is the application is running in clustered environment ? or the target application is totally diff application ?

Thanks
 
Loveleen Saroya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"diff server running on other machine".
lets say from tomcat i want to send it to weblogic on different jvm(same application)
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

lets say from tomcat i want to send it to weblogic on different jvm(same application)



According to me, in your case it is not distributed application, but the same application is running on diff. servers independently. So there is no question of request re-sheduling / load balancing etc. Still we can pass the bean set in request scope as attribute without serialization using request dispatcher.

Try getServletContext().getContext(uripath) to get the Context of another application and then use requestDispatcher on this context. But the getContext() method can return null for security reasons.

Refer Severlet API of ServletContext for more details on this method.

Hope it helps you.
 
Loveleen Saroya
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Narendra.. so when r u plannin to appear for the certification?
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Try getServletContext().getContext(uripath) to get the Context of another application and then use requestDispatcher on this context. But the getContext() method can return null for security reasons.



This doesn't work with tomcat inspite of making the necessary configuration changes. You can try with commercial application servers. I heard people telling inter-context forwarding is working fine with Weblogic.
[ November 16, 2005: Message edited by: Vishnu Prakash ]
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Loveleen,

I had purchaced the voucher, but not yet finalized the date.

Thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic