views:

88

answers:

2

i have windows service app and i want to use web interface for my app instead of gui. But i wonder how to make a servlet in jetty communicate with its hosted application - the windows service app.

Thank you.

A: 

you mean how to have a servlet communicate with it's container? http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContext.html might be a good place to start.

No, i means the app that contains jetty.Thank you.
robinmag
+1  A: 

Since you are going from inside a JVM (jetty) to outside the JVM (your service), you will probably have to use sockets, unless you want to delve into JNI (java native interface), but that's probably more work than you want.

I am assuming that your windows service is an actual native windows app and not a Java app with a service wrapper around it.

Good luck.

cjstehno
No, my windows service is a java app with a wrapper. My problem is how can i provide access to my java app for a webapp run inside jetty.Thank you.
robinmag
Then when you embed jetty you can pass a reference to your service application into it as a ServletContext attribute or something along those lines. Socket connections would still work, though it would be a more complex solution in this case since you can get direct access.
cjstehno