Re: [jetty-user] How to link to images from servlet

Michael Gorovoy <[email protected]>
Newsgroups gmane.comp.java.jetty.support
Message-ID <[email protected]>
You should add org.eclipse.jetty.servlet.DefaultServlet<http://download.eclipse.org/jetty/stable-7/xref/org/eclipse/jetty/servlet/DefaultServlet.html>to
your ServletContextHandler and map it to some context path (e.g.
/images/*), and configure the DefaultSerlvet to serve the images from the
location of your choice. Please see Embedding Jetty
tutorial<http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty#Setting_a_ServletContext>
for
more information.

On Thu, Feb 24, 2011 at 7:01 AM, andrej rolih <[email protected]> wrote:

>  Can you explain this a little? What sort of filter? How can I implement
> it? All I want is to display images in the servlet. Problem is that I don't
> know how to get to them. Oh and the server itself is embedded into my
> application - if this changes anything.
>
> ------------------------------
> Date: Wed, 23 Feb 2011 18:12:33 -0800
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [jetty-user] How to link to images from servlet
>
>
> On 2/23/2011 5:20 PM, andrej rolih wrote:
>
> Hi!
> I have a one ServletContextHandler with one servlet added - with path "/*".
> Problem is that I don't know how to serve a simple image/stylesheet. If I
> open localhost:8080/ my servlet appears, if I open localhost:8080/whatever
> my servlet appears ... I want / to be reserved for the servlet but I need
> something like /files to serve my images/stylesheets. Problem is that I
> don't know how to serve static contect inside my servlet.
>
> Thank you for any help!
>
>
> It sounds like a filter would better suit your needs.
>
> --
> 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
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.