You must have some url to specify for the IMG tag in the browser html. in html images just need some url to work.

you should check if the request is authorized inside DynamicImageResource. probably a good place to do this in

        public IResourceStream getResourceStream()

get the current web request with

  WebRequest request = (WebRequest)RequestCycle.get().getRequest()

You probably need Session.get() for that to get the current user's web session. be sure to synchronize access to it to avoid concurrency issues.


cheers
Peter



Am 13.01.2009 um 15:28 schrieb Daniele Dellafiore:

Hi all.

I am working on a fine way to serve some static images.
Imagine a webapp a la flickr. I have some images to be served inside a
slideshow AND I do not want that the real URL can be visible. In fact,
there is a policy about authorization to see images, so I need my
webapp to validate the request and then serve the images.

So, I cannot use the AttributeModifier and insert the "src" attribute
to the image. I use a custom DynamicImageResource reading image from
file system this way to implement getImageData()

return IOUtils.toByteArray(new FileInputStream(image));

well, as you can guess, I have privilege problems on accessing file
system within the servlet container cause my images are not stored
under the webapp classpath.

Now, what is for you the best way to solve this?
Configure apache web server to access the directory where image files
are stored and then serve them via wicket? I need to use a
DynamicImageResource due to privacy as told before, so I can open a
connection to httpd via HttpClient or some similar libraries and get
the byte stream?

Any other idea?

Thanks. You can see the slideshow in action here:
http://code.google.com/p/wicket-slides/
I started contributing the project some weeks ago and now it is base
on smoothgallery 2.0, there is also a demo app and a maven2 pom.

The code for loading resources from file is still in my app but I will
publish it there when it will be enough complete.

What about put that project under wicket-stuff? I can check the
original author for permission.

--
Daniele Dellafiore
http://blog.ildella.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to