Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Servlet Interest »

Re: Dynamic image generation servlet...

Paul Copeland

2004-11-14


In the Perl spirit that every easy problem should have a minimum of four
equally valid solutions, he could also use the html BASE tag to set the
relative URL for the rest of the document.

- Paul Copeland
JOT Object Technologies http://www.jotobjects.com

>Date:   Sat, 13 Nov 2004 16:42:14 +0000
>From:   Nic Ferrier <nferrier@(protected)>
>Subject: Re: Dynamic image generation servlet...
>
>Johan Hahn <johahn2003@(protected):
>
>
>
>>Michael Burbidge wrote:
>>[snip]
>>
>>
>>>Note that the ImageServlet is registered to handle URI from the root
>>>context of the form "/image". I would think then that the URI in the
>>>the html snippet <img src='/image?name=imagename'> would get resolved
>>>by dispatching to my ImageServlet. But it doesn't work.
>>>
>>>
>>Try
>>
>>  <url-pattern>/image*</url-pattern>
>>
>>It should work without explanaition.
>>
>>
>
>I don't think that's the problem.
>
>  <url-patten>/image</url-pattern>
>
>should match the url:
>
>  http://somehost/image?something=xxx
>
>I think the poster may have got the context path mucked up. The
>request path he gave for calling his image directly was this:
>
>  http://localhost:8080/demo/image
>
>which indicates that the webapp is mapped to /demo on localhost.
>
>But he said he was putting the following in his HTML page:
>
>  <img src='/image?name=imagename'>
>
>Well, that's never going to work because /image is not bound to
>anything.
>
>Instead he should use:
>
>  <img src='/demo/image?name=imagename'/>
>
>Or alternately use relative paths. If the HTML page is being served
>from, for example /demo/index.html then his HTML could be this:
>
>  <img src="image?name=imagename"/>
>
>
>
>In a more advanced note: if relative paths are not possible then you
>can still make your HTML position portable by generating the link to
>the image in a servlet, eg:
>
>  out.println(request.getContextPath() + "/image?name=imagename");
>
>
>--
>Nic Ferrier
>http://www.tapsellferrier.co.uk
>
>___________________________________________________________________________
>To unsubscribe, send email to listserv@(protected)
>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
>
>------------------------------
>
>End of SERVLET-INTEREST Digest - 12 Nov 2004 to 13 Nov 2004 (#2004-162)
>***********************************************************************
>
>
>
>
>

___________________________________________________________________________
To unsubscribe, send email to listserv@(protected)
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
©2008 junlu.com - Jax Systems, LLC, U.S.A.