Andy Jefferson wrote:
> Christian Mack wrote:
> >Andy Jefferson wrote:
> >>
> >> Simple one. How to access a particular image file via a servlet ...
> >>
> >> For example I have a servlet in
> >>
> >> /home/httpd/servlets/uk/co/demon/ajsoft/Invoice/
> >>
> >> and images in
> >>
> >> /home/httpd/servlets/uk/co/demon/ajsoft/Invoice/images/
> >Your image file has to live in the webserver directory, not in the servlet
> >directory.
> >
> >So use somthing like:
> >/usr/local/apache/htdocs/ajsoft/images/delete.gif
> >To store the gif, and use:
> ><IMG SRC="/ajsoft/images/delete.gif">
> >to give it back to the client.
>
> Thanks. I was aware that I could put images in there, *but* a servlet should be
> able to be packaged on its own, and to pick images up from its own space. A
> mechanism *should* be available for doing this - either via Apache, or via
> Jserv. For example, if I had my servlet within a 'jar', I wouldn't want to have
> to copy the images into the web document root area.
>
> TIA
> --
> Andy
>
You are right ... there should be such mechanisms. What you need was added to the
version 2.1 API specification for servlets, in the form of
ServletContext.getResource(). However, at this point in time, Apache JServ
version 1.0b4 supports only the 2.0 API, which does not include this capability.
Work is in progress on 2.1 compatibility for Apache JServ version 1.1. Volunteers
are needed to complete the coding, testing, and documentation.
Craig McClanahan
----------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]