Tuesday, October 26, 2010

Re: How do I send program generated Images to my users?

if your servlet generates an image, why do you want to get it saved on
the disk? I'd also do it the way Daniel suggested, so just keep your
image generating servlet as standalone, better yet allow extensions so
you can inquire an image not only like /imageGenerator but /
imageGenerator.jpg, then you also dont need to explicitely generate
mime header.

so in web.xml you map your generator:

<servlet-mapping>
..
<url-pattern>/imageGenerator/*</url-pattern>
</servlet-mapping>

and later, if telling the url of the image in the GWT module, you dont
build the url with getModuleBaseUrl(), but rather use host-relative
url, like new Image("/imageGenerator/whatever.jpg")

you can pass the values to your generator either via url params (/
imageGenerator/image.jpg?name=star) or via pathInfo (/imageGenerator/
image/name/star.jpg)

On 25 Okt., 22:36, Greg Dougherty <dougherty.greg...@mayo.edu> wrote:
> Hi all,
>
> My servlet is creating images that I need to send to the client.  My
> first thought was save the image to a file, then send the path to that
> image to the client, which can then call new Image
> (GWT.getModuleBaseURL () + imagePath);
>
> This worked just fine in the development environment.  But when I
> deploy to Tomcat, if I try to use a relative path, it does it from
> where Tomcat was started, rather than from my module's base.  For
> obvious reasons, I'd prefer not to try to save images to a hard-coded
> path (makes it a bit difficult to move the app around).
>
> Is there a clean way to get my module's base path, so I can save the
> images relative to that?  If not, what IS the approved way to pass
> program generated images to the client?
>
> TIA,
>
> Greg

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate