I have a jar file embedded with jetty and a war file running on winstone. I need to embed two projects with same server or is it possible to embed winstone with jetty server to run on same port?
No, you can't combine those on the same port.
However, you can do something else ...
theserver/src/main/java/jetty/livewar/ServerMain.java
from the embedded-jetty-live-war
example project (maintained by the Jetty Project)The end result is a single Server instance, with 2 webapps running in it.
You can choose to have it exist as a live-war (aka winstone like), or as a Jar executable that just loads the WebAppContext
of the war file as a second handler on the Server. (use a HandlerCollection
or HandlerList
with the Server.setHandler()
call)