• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Listening for events from different app

 
Maciej Majewski
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there a way to let's say deploy 2 application A and B on the web server and in application A listening for session events from application B?

If I setup a HttpSessionListener in A it will be listening only for events regarding application A.

What I want to achieve is that I already have an application which I can't modify. So I would like to implement another application which could capture session timout of this first application.

Thanks
Maciej
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34214
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maciej,
You can't. You need to change application B to add the listener or not implement the functionality.
 
Maciej Majewski
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There must some kind of a solution.

I was thinking about some kind of Global Session Listener or maybe implementing web filter which could intercept HTTP request and responses. But I couldn't google for anything meaningful.

Thanks
Maciej
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Maciej,

I'm not 100% sure if it's possible to track HTTP sessions from different web apps but I think it's not like Jeanne already said. And there are many good reasons why this shouldn't be possible.

Perhaps it would be easier to find a solution if you could tell us a little bit more what exactly you're trying to achieve

The first solution that comes to mind is to monitor your sessions in the same application A with the session listener. And than this listener could use another communication mechanism to interact with application B. Depending on what you're trying to do and other requirements you could think about socket connections, RMI or JMX to communicate between web appication A and B.

Marco
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maciej Java:
There must some kind of a solution.

I was thinking about some kind of Global Session Listener or maybe implementing web filter which could intercept HTTP request and responses. But I couldn't google for anything meaningful.

Thanks
Maciej


No, sessions are application specific. So you have to attack it from the application B side, there is no global way of doing this.

A better question may be, why do you need access to application B's sessions? There may be a better way to do what you need by-passing the session objects themselves.
 
Maciej Majewski
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But application B doesn't offer communication/interaction mechanisms.

The problem is that on session timeout app B displays login screen. However I'm using different way to login to app B that this screen. So I would like to deploy other app A which would intercept session timeout and redirect the user browser to proper page instead of this login screen.

Thanks
Maciej
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't it be possible to add a servlet/JSP to your application B which you could configure as an interception filter for the unwanted login screen in the web.xml descriptor and replace the login screen this way? This is just an idea. Unfortunately I don't know ad hoc if it's possible to add some servlets/JSPs to a web application if you don't have the source code (I guess you don't have it?!?) Perhaps this is an option for you...

Marco
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Maciej Java", please check your private messages for an important administrative matter.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maciej Java:
The problem is that on session timeout app B displays login screen. However I'm using different way to login to app B that this screen. So I would like to deploy other app A which would intercept session timeout and redirect the user browser to proper page instead of this login screen.
Why on earth do you need two apps for this? This problem has been long-solved using filters and the session. Why all the extra noise of a second application?
 
Maciej Majewski
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marco Ehrentreich:
Wouldn't it be possible to add a servlet/JSP to your application B which you could configure as an interception filter for the unwanted login screen in the web.xml descriptor and replace the login screen this way? This is just an idea. Unfortunately I don't know ad hoc if it's possible to add some servlets/JSPs to a web application if you don't have the source code (I guess you don't have it?!?) Perhaps this is an option for you...

Marco


Unfortunately I can't. App B is out of the box application bought by my company hosted on ISS and Sun Web Server which I can't touch.
What I can probably do is deploy some other application to this web server. And this other application should make some interception etc but from above answers this seems to be imposible.

However e.g. here http://3hq.eu/?16a I found sth. about Global servlet listeners.
 
Maciej Majewski
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Why on earth do you need two apps for this? This problem has been long-solved using filters and the session. Why all the extra noise of a second application?


This was just an idea. If you read my previous post in this topic you will notice that I also mentioned Global Session Listeners and web filters.

However could you describe how filter could help in this kind of problem or just provide some link on the web?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maciej Java:
Unfortunately I can't. App B is out of the box application bought by my company hosted on ISS and Sun Web Server which I can't touch.
Ah! That's the key to the puzzle. You are not going to be able to affect "app B" without the ability to make changes to it.

Imagine the security implications if you could!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34214
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maciej Java:
Unfortunately I can't. App B is out of the box application bought by my company hosted on ISS and Sun Web Server which I can't touch.
What I can probably do is deploy some other application to this web server. And this other application should make some interception etc but from above answers this seems to be imposible.

However e.g. here http://3hq.eu/?16a I found sth. about Global servlet listeners.

"global" servlet listeners still involve changing the app. Or rather having WebSphere (since it's an IBM link) change them on your behalf.

From that link:
To implement global listening, a listener is registered at the Web container level and is propagated to all of the installed and new Web applications.

This is changing the application you aren't "allowed" to change. The difference is that you aren't redeploying it.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic