Hi, Antony,

Yes, the image request is replaced by a call to the servlet HOME.

Now, you're facing a little problem. With any other directory mapping, you
would just have to replace /directory/* with /directory/. For example, if
you map /home/, any request to /home/image/image.gif would be statically
served. This mean you could request /home/myfile.html with myfile.html
containing :

        <img src="images/test.gif">

or :

        <img src="/home/images/test.gif">

or even :

        <img src="/images/test.gif">

No mapping will occur in any case (in the last case, the images directory is
simply not under the mapped "home" directory).

But if you map the document root directory, mapping / will give the same
result as mapping /* !

In both cases, any request to any document will go to the sevlet. In that
case, you have no way to access any other ressource on the server through an
HTTP request. The only way to access other ressources is through file access
from the servlet. (You can't forward because the forward will be intercepted
(because of the mapping) and this will result in a recursive call to the
servlet. (It will cause a EXCEPTION_STACK_OVERFLOW exception and crash the
JVM within 3 seconds.)

So, the rule might be : Don't map the document root directory !

Pierre-Yves



-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]De la part de t t
Envoy� : mercredi 25 juillet 2001 05:04
� : [EMAIL PROTECTED]
Objet : Re: Deployment of Servlets


Hi

I have put in my sevlet

 <servlet-mapping>
   <servlet-name>HOME  </servlet-name>
   <url-pattern>/*</url-pattern>    --(1)
  </servlet-mapping>

Which works fine, it maps all requests to the
controller servlet.  However when this controlling
servlet wants to display a jsp/html page which has an
image in it, ie

<IMG SRC="/images/test.gif">

then this image is not displayed.   Is the mapping (1)
causing the image request to be replaced by a call to
the servlet HOME?  If so/not what can I do so I can
display the image?

Cheers

Antony

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to