aspose file tools*
The moose likes Servlets and the fly likes Sharing of session objects across two web applications running on same server instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Sharing of session objects across two web applications running on same server instance" Watch "Sharing of session objects across two web applications running on same server instance" New topic
Author

Sharing of session objects across two web applications running on same server instance

sandeep Kumar
Ranch Hand

Joined: Sep 19, 2007
Posts: 41
Hi,

I have a requirement as below:

There are two web applications running on the same server instance. If there is a requirement as I have to use data in session object of webApp1 in webApp2.

Can you please suggest me the best way to implement it?

Thanks in Advance.

Cheers,
Sandeep.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

How about using a database?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
sandeep Kumar
Ranch Hand

Joined: Sep 19, 2007
Posts: 41
Hi Paul Sturrock,

First of all thanks for your reply.

Due to some client specific constraints, I cannot use the Database. Keeping apart form Database and RMI, Can you please suggest me the other way.

What if I serialize the object into a flat file and then FTP that file? I think this would again be some performance hit.
Is there any way we can send the data in request to another application?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

If you abandon the use of the session (no bad thing, by the way) and redesign your applicaitons to send state with the request that would work. Otherwise you will need some common persistence mechanism to share the data in. FTP doesn't sound the like the right mechanism, things will always be out of date. If you can't use RMI either this is harder to do - I was going to suggest a distributed cache, but distributed caches are RMI based.
Aniruddh Joshi
Ranch Hand

Joined: Jul 29, 2008
Posts: 275

persist the session object ?


Anrd
"One of the best things you could do is to simplify a larger application into a smaller one by reducing its process and complexity - Fowler"
sandeep Kumar
Ranch Hand

Joined: Sep 19, 2007
Posts: 41
yep. I think sending through request would be right choice for my requirement.

Paul, Thanks for your reply.
Aniruddh: I dont want to persist the session object. Thank you for your suggestion.

Cheers,
Sandeep.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Sharing of session objects across two web applications running on same server instance