[jetty-user] Best way to serve resources from arbitrary location?
Chris <[email protected]> Mon, 18 Apr 2011 14:39:45 -0500
| Newsgroups | gmane.comp.java.jetty.support |
|---|---|
| Message-ID | <[email protected]> |
In our app we'd like to serve static resources from different locations
depending on some rules. For example, if the request is for
http://foo.example.com/bar.html, we might want to serve that request
from the /path/to/foo directory and not from the webapp directory.
In some cases, we'll want to serve the resource from a URL. For example,
if the request is for http://foo.example.com/myimage.jpg, we might want
to serve it from Amazon S3:
http://images.foo.com.s3.amazonaws.com/myimage.jpg
I've been struggling with how best to do this. I could just implement
all the rules in a servlet or servlet filter, and write each file
directly to the response object, but then I lose the benefit of all the
things that the default Jetty handlers do, like deal with compressed
files, caching, setting content length, deal with HEAD requests, etc..
I don't want to reinvent the wheel. What, in general, is the best way to
get Jetty's default resource serving mechanism to load resources from
arbitrary locations?
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email