[Jetty-support] Jetty 6: Serving Multiple Contexts in a single Web application
Ali Beyad <[email protected]> Thu, 31 Mar 2011 18:22:23 -0400
| Newsgroups | gmane.comp.java.jetty.support |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I have tried to search the Jetty 6 documentation for an answer to my
question, but have so far been unsuccessful. I have a web app, lets call it
myApp. It is stored under the webapps folder. I want all requests to
http://server:8080/myApp to map to webapps/myApp. However, I have some
static files in another location that I want to serve under the URL
http://server:8080/myApp/docs. That is, I have some files in
c:\some\other\location, and I want requests to
http://server:8080/myApp/docsto map to this location. For example, a
request for
http://server:8080/myApp/docs/fileX.pdf to map to
c:\some\other\location\fileX.pdf.
Is this doable within Jetty configuration (either jetty.xml or
webdefault.xml or web.xml or any other configuration file)? If anyone could
provide me some guidance on this, I would be greatly appreciative. I have
tried configuring ContextHandlers and ResourceHandlers to no avail (perhaps
I'm doing it wrong?). The closest I've come to getting what I want is by
creating a jetty-web.xml file with the following:
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/myApp</Set>
<Set name="baseResource">
<New class="org.mortbay.resource.ResourceCollection">
<Arg>
<Array type="java.lang.String">
<Item>c:/location/docs</Item>
<Item><SystemProperty name="jetty.home"
default="."/>/webapps/myApp</Item>
</Array>
</Arg>
</New>
</Set>
</Configure>
But this maps the contents of the doc folder and webapps/myApp to the
http://server:8080//myApp URL.
Thanks again in advance for your help.
Ali
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Jetty-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jetty-support