Re: File system resource for static content

2008-12-14 Thread Hassan Schroeder
On Sun, Dec 14, 2008 at 1:47 PM, Robert Drescher wrote: > My reader servlet accepts a param "file" so far, since i haven't figured out > how to do the mapping and parsing to do the /WebApp/files/filename.jpg so > far. But that should be a quick fix. see HttpServletRequest.getPathInfo() -- Hass

Re: File system resource for static content

2008-12-14 Thread Robert Drescher
Ok, thanks to all, I finished my Reader Servlet. I created a work dir which has to be included into the webapps.policy so that webapps can read and write to it. My reader servlet accepts a param "file" so far, since i haven't figured out how to do the mapping and parsing to do the /WebApp/files/fi

Re: File system resource for static content

2008-12-14 Thread Peter Abramowitsch
I had to do something like that myself. Here's a little method that creates a folderpath for each unique session. public File getTempDir(HttpSession hsess) { String path = hsess.getServletContext().getRealPath("/"); // "/" context root of the application return new File(path, h

Re: File system resource for static content

2008-12-14 Thread Rusty Wright
That seems like the usual race condition problem to me. Hopefully one of them will get an error, at worst, and it won't silently overwrite the file with the one from whoever won the race. André Warnier wrote: André Warnier wrote: Hi. What if user-a uploads a file called "abc.jpg" and then u

Re: File system resource for static content

2008-12-14 Thread Hassan Schroeder
On Sun, Dec 14, 2008 at 12:45 PM, André Warnier wrote: >> What if user-a uploads a file called "abc.jpg" and then user-b uploads a >> file called "abc.jpg" ? Who wins ? Hopefully, everyone wins, since the Klever Koder has checked first to be sure an existing file isn't being overwritten :-) --

Re: File system resource for static content

2008-12-14 Thread André Warnier
André Warnier wrote: Hi. What if user-a uploads a file called "abc.jpg" and then user-b uploads a file called "abc.jpeg" ? Who wins ? Worse, they do it at the same time.. ;-) Ooops, I meant "abc.jpg" both times of course. -

Re: File system resource for static content

2008-12-14 Thread André Warnier
Hi. What if user-a uploads a file called "abc.jpg" and then user-b uploads a file called "abc.jpeg" ? Who wins ? Worse, they do it at the same time.. ;-) - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additio

Re: File system resource for static content

2008-12-14 Thread Yuval Perlov
The image would work because it is a separate hit (not "embedded"). For general info, if you did want to embed you would use You can also have the servlet map to something like /files/* and parse the path to find out which file is being requested - this makes the file url feel more nati

Re: File system resource for static content

2008-12-14 Thread Hassan Schroeder
On Sun, Dec 14, 2008 at 11:29 AM, Robert Drescher wrote: > In other words, if "/App/Reader" is my reader servlet, can I include an > image into jsp with ? Of course, it's just a URL. Better, just make it (or /App/images/image.jpg, or whatever). HTH, -- Hassan Schroeder --

Re: File system resource for static content

2008-12-14 Thread Robert Drescher
Exactly. Since we are supposed to write an application that's running without extracting the war, Steves approach was my first try, but it's not working that way :( Also, symlinks are a good way in posix systems, but then the app is not platform independent anymore. The approach of a reader servl

Re: File system resource for static content

2008-12-14 Thread Yuval Perlov
The problem with this approach is that when you upgrade the war file the files will be deleted. I believe It is better to save the files outside the web app and deliver them either with a symbolic link from within your war file or using a reader servlet. Yuval Perlov www.r-u-on.com On Dec

Re: File system resource for static content

2008-12-14 Thread Steve Ochani
Send reply to: Tomcat Users List Date sent: Sun, 14 Dec 2008 12:56:17 +0100 From: Robert Drescher To: users@tomcat.apache.org Subject:File system resource for static content > Hello users, > I'm trying to find the best practice way for implementing the > following: I want a s

Re: File system resource for static content

2008-12-14 Thread André Warnier
Hi. Not a direct answer, but did you look at the webdav app ? At least for ideas. Robert Drescher wrote: [...] I want a servlet to perform file uploads and to store the files in the local filesystem. - To unsubscribe, e-mail: