Originally Posted by jwray
Great minds think alike!!! That is pretty much what I want to do. I have now structured my project so that the Service Layer and DAO interfaces and impl classes are in a subproject which produces a .jar file, which may be used by the main project(which accesses remote beans by way of HttpInvokerProxyFactoryBean) and the web-app(which contains the contains the subprojects artifact/.jar file in this case).
Ideally, it would be nice to have a uniform way of starting the embedded Jetty instance, whether it is running locally or on a remote server. There seem to be a few ways to do this, both programatically and declaratively. However, I need to figure out the most practical way to accomplish this.
For example, if I use the declarative approach, feeding jetty.xml into a Spring ApplicationContext(similar to Sanjiv's example on his blog), I would think I need to explode the web app's war file and use something like Sanjiv is using, i.e.
to 1) start the Jetty Server and 2) load the web-app
FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(path/to/jetty.xml);
Here is Sanjiv's jetty.xml file:
The part I don't quite understand about this is the contextPath and war property settings under WebAppContext. On the Jetty sight, the examples conform more to how you are loading your web-apps.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
class="org.mortbay.jetty.Server" init-method="start" destroy-method="stop">
<bean id="Connector" class="org.mortbay.jetty.nio.SelectChannelConnector">
<property name="port" value="8181"/>
<property name="contextPath" value="/"/>
<property name="war" value="../conf/web">
The web.xml file is responsible for loading the web-apps Spring App Context file, which must be in the class path.
That is pretty much it. I will let you know what happens.