Re: [jetty-user] Best way to serve resources from arbitrary location?

Steve Sobol <[email protected]> Mon, 18 Apr 2011 12:51:18 -0700
Newsgroups gmane.comp.java.jetty.support
Message-ID <[email protected]>
This should be an FAQ...

Chris wrote:
> 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?


Create a ResourceHandler, maybe?

http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/server/handler/ResourceHandler.html

http://tinyurl.com/jetty7resourcehandler



-- 
Lobos Studios - Website Design, Programming, IT Support
Phone: 877.919.4WEB (877.919.4932) (Toll-free)
Phone: 760.684.8859 (Victor Valley)
www.LobosStudios.com -- www.facebook.com/LobosStudios
www.twitter.com/LobosStudios


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email