robinmag
robinmag

Reputation: 18120

communication between an embedded jetty and its parent application

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.

Upvotes: 1

Views: 1021

Answers (2)

vcycyv
vcycyv

Reputation: 11

You can use the same classloader to solve the problem by:

WebAppContext webapp = new WebAppContext(jetty_home + "/JavaServices", "/JavaServices");
webapp.setDefaultsDescriptor(jetty_home+"/etc/webdefault.xml");
webapp.setClassLoader(Thread.currentThread().getContextClassLoader());//THIS LINE IS THE KEY

Upvotes: 1

cjstehno
cjstehno

Reputation: 13994

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.

Upvotes: 2

Related Questions