Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call a Servlet from another app

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, this might most be possible. We have 2 applications that integrates seemlessly with each other. Now, we have a problem of destroying the session of both applications when the user logoff. Would it be possible for a Servlet to sendRedirect or forward to another servlet from another application?

App1(Logoff.do, destroy session) ----> App2(Logoff.do, destroy session) ----> App1(login.do)


I'm not using Struts, the .do is just a convention.... Thanks!
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Timothy Sam:
Hi guys, this might most be possible. We have 2 applications that integrates seemlessly with each other. Now, we have a problem of destroying the session of both applications when the user logoff. Would it be possible for a Servlet to sendRedirect or forward to another servlet from another application?

App1(Logoff.do, destroy session) ----> App2(Logoff.do, destroy session) ----> App1(login.do)


I'm not using Struts, the .do is just a convention.... Thanks!


You can sendRedirect() to resource which is not in your application but not forward().

But I think, through sendRedirect(), it's not possible to send sth with request...

May be you can have a central place (DB or XML or something) for communication between both the application. :roll:
[ November 22, 2006: Message edited by: rathi ji ]
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much! It seems that I need to put the complete URL String which is

http://www.google.com

because www.google.com just won't work in sendRedirect. Thank you!
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Timothy Sam:
Thank you very much! It seems that I need to put the complete URL String which is

http://www.google.com

because www.google.com just won't work in sendRedirect. Thank you!


Send redirect actually works from the client side.

Consider a situation where you log off from application 1 and then the first application after invalidating the session , sends a sendRedirect for the logoff of the second application.
Before the client opens the new fresh connection with the second web application , you close the browser. In that case your system goes to a inconsistent state.

forward jsp tag works for forwarding to other web applications also.Check how that works.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic