-
1. Re: save image in webapp/resources
rhusar Dec 6, 2011 9:45 AM (in response to myrabbitrules)Rather then answering the question you shoudl revise why you want to do that. This looks like a bad idea to me. If the images are permanent (which is unlikely since you want to store it with the app) then store it elsewhere in the filesystem or database. If the images are temporary store them in the memory (eg cache).
-
2. Re: save image in webapp/resources
myrabbitrules Dec 7, 2011 8:01 AM (in response to rhusar)I tried storing the image in local filesystem. But i then couldn't access image in xhtml. I guess this is because all content must be placed in deployed war (which does not contain stuff from local filesystem).
Concerning storing them in memory: How do I do that? Do you mean storing image as byte[]? If so I'm struggling with finding tags that accept byte[]. I found one in seam tag library, but I don't know if I can install seam tag library with jboss7 and maven.
-
3. Re: save image in webapp/resources
rhusar Dec 9, 2011 11:01 AM (in response to myrabbitrules)Well, its a fact that serving static images via Java is slower than letting Apache HTTPd serve them.
Thats why I think a better approach is to store images on the filesystem where HTTPd just serves them statically. In your Java side all you need is to send in your respose <img src="/static/images.png" /> and the context static just let the apache to handle and not pass all the way to Java. You will also have to handle deletion from the FS, authorization might become little bit more complicated. Anyway, depends on your use case :-)
HTH,
Rado