|
You can write to disk in a webapplication Use the work dir: ServletContext.getAttribute("javax.servlet.context.tempdir"); That will return a File object that points to the work dir for the current webapplication. Gili wrote: Ok, so to rehash some points: 1) Currently we parameterize the image URL on the session ID and parameters used to render the image 2) We write out the image to disk somewhere (although I don't know where, can you elaborate?)My personal requirements are: 1) Render image once per page, not per session or view. 2) Do not expose image parameters if possible. Ideally the URL should read "image<number>.<extension>" and we'll have some lookup table somewhere that maps image creation parameters to image URLs -> reuse the same image if the same parameters are used (server-side). I remember reading about JBoss not giving you write access to the webapp dir (heck, you could be running inside a JAR). I feel this problem related to handling links to images in general, not just dynamically generated ones, if their URL falls under the servlet context path. What we could do (solves all problems I know about) is handle image URLs within the WebApp servlet itself. That is, we never write the images to disk if they're dynamically generated and "cacheDir" (some new property I made up) is not set. For JBoss and others cacheDir will be unset so it'll default to caching in memory. For Tomcat and others, it'll be set to the default temporary directory for the webapp so we'll cache to disk. What will happen is that someone will refer to /MyWebApp/myImage.jpg -- the servlet will recognize that the URL refers to an image, use the appropriate resource location mechanisms -- and stream back the image (whether dynamic or static). And ideally we'd throw in a "image parameters -> image URL" mapping somewhere so we don't have to expose inner details to the HTTP clients. My only concern is that for JBoss, dynamically generated images would be expensive. Still, I don't think we have a choice in such cases if we absolutely cannot write to any directory. What do you think? Gili On Tue, 04 Jan 2005 15:45:50 +0100, Eelco Hillenius wrote: |
- Re: [Wicket-develop] RoundCornerPanel performance concerns Johan Compagner
- Re: [Wicket-develop] RoundCornerPanel performance con... Gili
- Re: [Wicket-develop] RoundCornerPanel performance... Eelco Hillenius
- Re: [Wicket-develop] RoundCornerPanel perform... Gili
- Re: [Wicket-develop] RoundCornerPanel per... Eelco Hillenius
- Re: [Wicket-develop] RoundCornerPane... Eelco Hillenius
- Re: [Wicket-develop] RoundCornerPanel performance con... Jonathan Locke
