Re: How to access Sessions outside of class

2014-10-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 10/29/14 2:01 PM, Jason Ricles wrote: Yes Chris RMI is a pain in the ass and I have been trying to make a websocket client endpoint now. It however keeps closing and I am not to sure as of why right after the connection is open.

Re: How to access Sessions outside of class

2014-10-29 Thread Jason Ricles
foo is not a webapp, it is a separate program running on the computer as a daemon. It has to do this stuff for it needed to be ran like this. bar is basically the gui to the daemon, providing what is happening on the machine to someone at another computer, since the machine is headless these

Re: How to access Sessions outside of class

2014-10-29 Thread Martin Grigorov
Hi, On Wed, Oct 29, 2014 at 2:28 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: foo is not a webapp, it is a separate program running on the computer as a daemon. It has to do this stuff for it needed to be ran like this. bar is basically the gui to the daemon, providing what is happening on

Re: How to access Sessions outside of class

2014-10-29 Thread Tim Watts
On Wed, 2014-10-29 at 08:28 -0400, Jason Ricles wrote: foo is not a webapp, it is a separate program running on the computer as a daemon. It has to do this stuff for it needed to be ran like this. bar is basically the gui to the daemon, providing what is happening on the machine to someone at

Re: How to access Sessions outside of class

2014-10-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 10/29/14 8:28 AM, Jason Ricles wrote: foo is not a webapp, it is a separate program running on the computer as a daemon. I understand that. I'm only suggesting that, since you have to communicate with Websocket-speaking web

Re: How to access Sessions outside of class

2014-10-29 Thread Jason Ricles
Yes Chris RMI is a pain in the ass and I have been trying to make a websocket client endpoint now. It however keeps closing and I am not to sure as of why right after the connection is open. http://stackoverflow.com/questions/26636452/tomcat-clientendpoint-websocket-keeps-closing has the code,

Re: How to access Sessions outside of class

2014-10-28 Thread Johan Compagner
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

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
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 jcompag...@servoy.com wrote: I would like to be able to access my sessions from an external java class, however each time I do

Re: How to access Sessions outside of class

2014-10-28 Thread Martin Grigorov
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 jgr...@alum.lehigh.edu wrote: No, it is external as in it is running in a daemon on a linux

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
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? On Tue, Oct 28, 2014 at 8:24 AM, Martin Grigorov martin.grigo...@gmail.com wrote: Hi, In this case you will have

Re: How to access Sessions outside of class

2014-10-28 Thread Jose María Zaragoza
2014-10-28 13:44 GMT+01:00 Jason Ricles jgr...@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

Re: How to access Sessions outside of class

2014-10-28 Thread Martin Grigorov
On Tue, Oct 28, 2014 at 2:51 PM, Jose María Zaragoza demablo...@gmail.com wrote: 2014-10-28 13:44 GMT+01:00 Jason Ricles jgr...@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

Re: How to access Sessions outside of class

2014-10-28 Thread David kerber
Can you simply serialize the data to disk in one process and read it in the other? On 10/28/2014 8:44 AM, Jason Ricles wrote: 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

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
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

Re: How to access Sessions outside of class

2014-10-28 Thread Martin Grigorov
On Tue, Oct 28, 2014 at 3:06 PM, Jason Ricles jgr...@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

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
Does it matter that foo will not be running on a server? It will be running as a standalone on the machine, unaware of tomcat basically. On Tue, Oct 28, 2014 at 9:36 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Oct 28, 2014 at 3:06 PM, Jason Ricles jgr...@alum.lehigh.edu wrote:

Re: How to access Sessions outside of class

2014-10-28 Thread chris derham
On 28 October 2014 11:06, Jason Ricles jgr...@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

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
Communicate means something happens that the daemon is monitoring, so thus the daemon sends a message to the websocket server running on the webapp, so that message can get relayed to the webpage from the server and the daemon will also need to get messages from the webapp. It will then be two way

Re: How to access Sessions outside of class

2014-10-28 Thread Martin Grigorov
On Tue, Oct 28, 2014 at 3:38 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Does it matter that foo will not be running on a server? It will be running as a standalone on the machine, unaware of tomcat basically. http://enable-cors.org/ should be enough to allow external clients. On Tue,

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
I can not using anything outside of tomcat to accomplish this, due anything outside of tomcat being on an approved list. On Tue, Oct 28, 2014 at 9:51 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Oct 28, 2014 at 3:38 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: Does it matter

Re: How to access Sessions outside of class

2014-10-28 Thread Martin Grigorov
On Tue, Oct 28, 2014 at 3:54 PM, Jason Ricles jgr...@alum.lehigh.edu wrote: I can not using anything outside of tomcat to accomplish this, due anything outside of tomcat being on an approved list. CORS is not yet another software. Read in the web about it. On Tue, Oct 28, 2014 at 9:51 AM,

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
I am looking at it but am having trouble seeing the connection, do you care to expand on how it can be used other then for the http request? On Tue, Oct 28, 2014 at 10:00 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Oct 28, 2014 at 3:54 PM, Jason Ricles jgr...@alum.lehigh.edu wrote:

Re: How to access Sessions outside of class

2014-10-28 Thread Tim Watts
On Linux/Unix you could use a FIFO (aka named pipe) and have each side connect to it with a stream. But that's non-portable and probably not too elegant/robust. What's the problem with using a socket? Or better yet, a message broker like ActiveMQ like someone else has already suggested? On

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
Yes we are trying to portable, well the socket is the last resort. We are trying to avoid it until now but will go that way if we have to if there is no other way. Mostly due to the data coming in and out writing our own socket will be complex but doable. As far as messaging broker, they are not

Re: How to access Sessions outside of class

2014-10-28 Thread Tim Watts
Any IPC that you have to write from scratch is going have a not insignificant level of complexity whether it's raw sockets, pipes, http, whatever. Since it sounds like you can't introduce any additional software packages, you might want to consider using RMI (see the java.rmi package). At least

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
Thanks Tim, That seems like the way to go. IT avoids us having to write our own protocols and everything and instead just code the logic for what action to take when a certain message is received. On Tue, Oct 28, 2014 at 10:27 AM, Tim Watts t...@cliftonfarm.org wrote: Any IPC that you have to

Re: How to access Sessions outside of class

2014-10-28 Thread chris derham
Couldn't you have the daemon write to a database, and have the web app read from the database? Then you could pass whatever message you wanted as a string? Chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For

Re: How to access Sessions outside of class

2014-10-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 10/28/14 9:06 AM, Jason Ricles 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

Re: How to access Sessions outside of class

2014-10-28 Thread Jason Ricles
Chris, foo has to run as a daemon outside of tomcat. It will be interacting with low level drivers through jni. I was looking at trying to do that with making a client endpoint in my daemon but i was having trouble getting it to connect to the websocket server. On Tue, Oct 28, 2014 at 12:21 PM,

Re: How to access Sessions outside of class

2014-10-28 Thread Terence M. Bandoian
On 10/28/2014 9:36 AM, Jason Ricles wrote: Thanks Tim, That seems like the way to go. IT avoids us having to write our own protocols and everything and instead just code the logic for what action to take when a certain message is received. Hi, Jason- RMI seems reasonable if foo and bar

Re: How to access Sessions outside of class

2014-10-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jason, On 10/28/14 3:06 PM, Jason Ricles wrote: Chris, foo has to run as a daemon outside of tomcat. It will be interacting with low level drivers through jni. While interesting, it's not terribly relevant. I was looking at trying to do that

How to access Sessions outside of class

2014-10-27 Thread Jason Ricles
I have the following code for a web-socket package comm2.hello; import java.io.IOException; import java.util.ArrayList; import javax.websocket.OnClose; import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint;