I am having a static resource folder external to the web application and am trying to configure it in Jetty 8. So far I have tried the following.
1) I have added a context handler in jetty xml as following:
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="context" class="org.eclipse.jetty.server.handler.ContextHandler">
<Set name="resourceBase"><SystemProperty name="JETTY_HOME" default="."/>/static/</Set>
</New>
</Item>
<Item>
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
and I have placed static folder in inside jetty-distribution folder.
I have also tried placing the static folder as static.war inside the webapps folder and it is not accessible with /static.
2) I have tried adding/changing the xml in the /contexts folder in the jetty distribution. Even that doesnt work.
Also, in my jetty-web.xml I have a webappcontext registered as below:
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Call class="org.eclipse.jetty.util.log.Log" name="debug">
<Arg>executing jetty-web.xml</Arg>
</Call>
<Set name="contextPath">/security</Set>
</Configure>
My static resource structure is as follows.
static
-css
- <all css files>
-images
- <further folders and images>
-js
- <all js files>
I am new to jetty, and started working in it from past few days. Any help is really appreciated.
Thanks