tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: How to access Sessions outside of class
Date Tue, 28 Oct 2014 13:36:39 GMT
On Tue, Oct 28, 2014 at 3:06 PM, Jason Ricles <jgr208@alum.lehigh.edu>
wrote:

> Ok so here is the problem I have been spinning my wheels on for day let me
> just lay it out.
>
> I have a daemon written in java running lets call it foo for simpleness on
> a linux machine that has the tomcat server running. On the tomcat server is
> a WAR file for a webapp called bar. In that webapp is a webpage with
> JavaScript websocket communication that connects to a websocket server that
> is also a part of the WAR file. So I have a webpage and a websocket server
> communicating with each other.
>
> I want the foo daemon and the websocket server on bar (web application) to
> be able to communicate with each other. Is there any way outside of sockets
> to have foo and the websocket server on bar do this?
>
>
You can use any Java WebSocket client in foo to send its own requests to
bar's web socket server.
This way it is yet another Session. And foo can communicate with the page's
client.



> On Tue, Oct 28, 2014 at 8:59 AM, Martin Grigorov <
> martin.grigorov@gmail.com>
> wrote:
>
> > On Tue, Oct 28, 2014 at 2:51 PM, Jose MarĂ­a Zaragoza <
> demablogia@gmail.com
> > >
> > wrote:
> >
> > > 2014-10-28 13:44 GMT+01:00 Jason Ricles <jgr208@alum.lehigh.edu>:
> > > >
> > > > Martin,
> > > >
> > > > I can not use hazelcast due to regulations I have to abide by, is
> where
> > > any
> > > > other built in way besides sockets that will allow me to share data
> > > between
> > > > the two processes?
> > >
> > >
> > > You could use an embedded ( or not ) messaging broker ( like ActiveMQ
> ) .
> > > Or any kind of in-memory database
> > >
> >
> > But this will be again socket based communication.
> >
> >
> > Let's start from the beginning:
> > What is your use case ?
> > What value will have a deserialized session in the second process ?
> >
> >
> > >
> > >
> > > >
> > > >
> > > > On Tue, Oct 28, 2014 at 8:24 AM, Martin Grigorov <
> > > martin.grigorov@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > In this case you will have to share the data between the processes.
> > > > > A simple and easy solution would be to use http://hazelcast.com/,
> > for
> > > > > example.
> > > > >
> > > > > On Tue, Oct 28, 2014 at 2:06 PM, Jason Ricles <
> > jgr208@alum.lehigh.edu>
> > > > > wrote:
> > > > >
> > > > > > No,
> > > > > >
> > > > > > it is external as in it is running in a daemon on a linux machine
> > > where
> > > > > the
> > > > > > tomcat server is also running.
> > > > > >
> > > > > > On Tue, Oct 28, 2014 at 4:35 AM, Johan Compagner <
> > > jcompagner@servoy.com>
> > > > > > wrote:
> > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > I would like to be able to access my sessions from
an
> external
> > > java
> > > > > > > class,
> > > > > > > > however each time I do sessionList.getsize() it keeps
coming
> > > back as
> > > > > 0,
> > > > > > > but
> > > > > > > > there is an active sessions. Is there any way I can
access
> the
> > > active
> > > > > > > > sessions in tomcat from an external java class?
> > > > > > > >
> > > > > > > > Jason
> > > > > > > >
> > > > > > >
> > > > > > > What is an external java class? Is it in the same class
loader?
> > so
> > > it
> > > > > is
> > > > > > > just part of the webapplication?
> > > > > > > then the above approach should work fine
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Johan Compagner
> > > > > > > Servoy
> > > > > > >
> > > > > >
> > > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message