This week's book giveaway is in the
We're giving away four copies of
Node.js in Action
and have Mike Cantelon, Marc Harter, T.J. Holowaychuk and Nathan Rajlich on-line!
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Node.js in Action
this week in the
How to specify output path for an image file?
Joined: Sep 12, 2006
Mar 18, 2007 17:20:00
I have an application deployed on
. The application is supposed to generate an Image file (myImage.png).
I want to display this image on a
page. When i run the application the image file is not generated in any of tomcat folder hierarchy.
The way i have specified the output path for the image is
PlanarImage image = PlanarImage.wrapRenderedImage(bi); String outputFile = "newpngG.png"; JAI.create("filestore", image, outputFile, "PNG", null);
How do i specify path so that this image is output in my tomcat/webapps/app folder?
Thank you in advance.
Joined: Dec 11, 2004
Mar 19, 2007 03:59:00
If the image is not under your webapp's directory structure, you'll need to write a
that streams the image to the browser.
This is not difficult.
I have an example app that does this.
Look for SimpleStream.
In that app, I'm using getResourceAsStream to read image files under the webapp's directory structure but hidden from the web under WEB-INF.
In your case, you will have to use
to read your image files but, otherwise, everything should be the same.
How to ask a question...
Simple Servlet Examples
I agree. Here's the link:
subject: How to specify output path for an image file?
File path after deployment
images in servlet
Accessing a folder within a web application...
regarding file creation on server -very urgent
Writing Image onto a WordDoc
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014