Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] ContextRoot resolution issue in Jetty 8

I have the following configuration in jetty.xml.  Any page of myapp
application that refers a style sheet located in  /webapps/myapp/styles
fails with page not found 404 error. Any idea why this ResourceHandler
configuration doesnt work. I could see all the requests to access any style
sheet resource is redirected to myapp WebAppContext. I could solve this
using a jetty default servlet configured in myapp web.xml.
Just wondering if there is any issue with  ResourceHandler configuration or
I am missing something. I would appreciate if any body can help me here...

 <!-- Set handler Collection Structure                            -->
   <!-- =========================================================== -->
   <Set name="handler">
     <New id="Contexts"
class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
       <Set name="handlers">
        <Array type="org.eclipse.jetty.server.Handler">
 <Item>
 <New class="org.eclipse.jetty.server.handler.ContextHandler">   (For all static resources)
<Set name="contextPath">/styles/*</Set>
<Set name="handler">
 <New class="org.eclipse.jetty.server.handler.ResourceHandler">
<Set name="directoriesListed">true</Set>
<Set name="resourceBase">/webapps/myapp/styles</Set>
 </New>
  </Set>
</New>
</Item>
<Item>
<New id="r3" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="Server"><Ref id="Server" /></Set>
<Set name="ContextPath">/</Set>
<Set name="War"><Property name="jetty.home" default="."
/>/webapps/myapp</Set>
</New>
</Item>
         </Array>
       </Set>
     </New>
   </Set>

Back to the top