Or, something similar, using the IOUtils class from Commons I/O (
http://commons.apache.org/io/):
InputStream resourceAsStream =
getServletContext().getResourceAsStream.(pathToImage);
resp.setContentType("image/gif");
IOUtils.copy(resourceAsStream,resp.getOutputStream);
Vince
On Mon, Nov 30, 2009 at 8:31 AM, bysse <[email protected]> wrote:
> This should get you going:
>
> InputStream resourceAsStream = getServletContext().getResourceAsStream
> (pathToImage);
> // use stream to read image data
> ...
> resp.setContentType("image/gif");
> resp.setContentLength(imageData.length);
> outputStream.write(imageData, 0, imageData.length);
>
> /Erik
>
> On Nov 30, 11:23 am, Prashant <[email protected]> wrote:
> > Hi,
> >
> > I have a servlet with request handler */file/** . I want to return a file
> *
> > /theme/bg.gif* for all */file/*.gif *. I can check for .gif extension
> then
> > how do i send */theme/bg.gif*, for */file/*.gif* without sending a
> redirect
> > ?
> >
> > Thanks.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.