Hi all,
thanks a lot for all solutions proposed.
I think I am going create the directory within my webapp, but without
symbolic link, as my images are temporary files.
So even if the directory is deleted it really does not matter
Thanks again
Romain
Li wrote:
you are right Moises, if you really
you are right Moises, if you really wanna write to somewhere within
the webapp deploy folder, a better is to make a soft symbol link point
to the directory that stores the image,
/webapps
---
---> /tmp/images/
so next time update the war, even the folder is
So, you need a directory where you can write files and serve them to
the web, and you don't want that directory to be hard-coded in your
application.
First, you need a way to specify the directory when the app is
installed. (In general your app may need a bunch of configuration
settings.) There a
I had a similar question, earlier... There is another issue here: you are
right that WAR files are expanded back into a folder - at least by default -
so one could still create a folder within the web app to write to, and which
is visible to browsers... Until one deploys an updated WAR file.
mailto:[EMAIL PROTECTED]
> Sent: Monday, August 07, 2006 5:32 AM
> To: Tomcat Users List
> Subject: Re: Writing files accessible from a browser
>
> You can use a servlet init param inside web.xml for avoiding hardcoded
> solutions.
> e.g.
>
> MY_PATH
> c:\my\path\
You can use a servlet init param inside web.xml for avoiding hardcoded
solutions.
e.g.
MY_PATH
c:\my\path\to\imgs
On 8/7/06, Romain Quilici <[EMAIL PROTECTED]> wrote:
Hi,
Hope I will be clear enough:
One part of my web application receives encodes stream that it has to
convert to jpg images.
hi,
1. even you deploy as war, later after start tomcat, it will still
generate a folder that actually tomcat uses normally. so in this case,
you still be able to use context path to write
2. if you wanna avoid other people modiy, you can create script/IO
stream object that generates folder befor
Oh I see,
something like that , i do not think taht this will work
String imagePath = path+"../imagedir";
but you will have to either convert path to instance of directory
object, or chop of the end by some string functions , using String
imagePath = path+"../imagedir"; as path works for browser
I agree with you, but
getContext().getRealPath("/"), will return the path to my webapp root,
so it means I am going to create my image dir under my webapp, which is
fine unless my application is deployed in a war file.
In such case I won't be able to write in my webapp.
Maybe using
String path
Hi,
to avoid using absolut paths you can find that out on runtime by
getContext().getRealPath("/") - will return your path to the root
regards
On 8/7/06, Romain Quilici <[EMAIL PROTECTED]> wrote:
Hi,
Hope I will be clear enough:
One part of my web application receives encodes stream that it
Hi,
Hope I will be clear enough:
One part of my web application receives encodes stream that it has to
convert to jpg images. When an image is written on the server, it
notifies a Servlet which pushes the name (or the url) of the newly
generated image inside client browser(thanks to pushlets
Hi,
It is not advisable to make your webapp dir writable, can you tell me
what exactly would you like to achieve so that I may get more info to
help out ...
On 8/7/06, Romain Quilici <[EMAIL PROTECTED]> wrote:
Hi,
thanks for the advice,
But I want to avoid harcoded links such as $APACHE_HOME\
Hi,
thanks for the advice,
But I want to avoid harcoded links such as $APACHE_HOME\httpdocs\images
or http://yourdomain/images/1.jpg";> in my jsp.
Indeed I don't want to modify these values if I decide Tomcat to run on
another port, or to install Tomcat in another directory or even OS. That
is
Hi,
Here are few steps of achieving it (just tested, and it works):
1. use FileOutputStream or any output streaming object to write a image file
into the directory
in Windows, the path string should look like:
"c:\apache_home\httpdocs\images\1.jpg"
in unix/linux, the path should look like
Thanks for the answer,
this solution was part of my investigation, and was actually the first
idea I had.
The problem with this approach is I don't know how to access the
/image_dir/ from within my web application.
Maybe using something like
String path = servletContext.getRealPath("/");
String
if you have apache server, you can write file to its home dir, and then use
http:image_name.suffix to view.
On 8/7/06, Romain Quilici <[EMAIL PROTECTED]> wrote:
Hi all,
I have been reading several messages about writing files inside a web
application, but I found no answer regarding my probl
Hi all,
I have been reading several messages about writing files inside a web
application, but I found no answer regarding my problem.
I need to write files on the file system that can be accessible with a
browser(I write images).
- The most reliable solution I found was to use the webapp's
17 matches
Mail list logo