Re: images not under the context root directory

2010-02-11 Thread Daniele Dellafiore
Hi. I am facing the same problem: user upload images and I want to access from wicket. Of course, user resources are not going to stay under the webapp context. I would prefer also to put this images wherever I want in the file system, not under the container folder as well. I have taken some

Re: images not under the context root directory

2010-01-29 Thread Matthew J
Question, as I am dealing with a similar issue, except I save my file to my glassfish directory (ie: glassfish/domains/domain1/uploads/ Videos/...). I can't seem to find the url though I have tried many different types of urls... For the record ((WebApplication )WebApplication

Re: images not under the context root directory

2010-01-29 Thread Riyad Kalla
Matthew, this seems like a glassfish question... if you can mount local system dirs in glassfish as web dirs, for example: alternatedocroot_1 from=/uploads/* dir=/Users/insane/path/under/netbeans/glassfish/domain1/uploads/Videos would you access that content using http://www.mysite.com/uploads/*

Re: images not under the context root directory

2010-01-29 Thread Matthew J
Correct, Glassfish would allow this; however, if I can do it programmatically with ease I would rather do this (as installations may change and I would rather not have the static uri). I assumed Wicket had access to all files in the context root (or what I assume is one, which maybe

Re: images not under the context root directory

2010-01-29 Thread m j
Well after my question I started researching and changed my upload folder to: String path = WebApplication.get().getServletContext().getRealPath(); Folder uploadFolder = new Folder(path+/uploads); I can now reference the files via the url (.../uploads/..), so much simpler this way... I suppose

Re: images not under the context root directory

2010-01-29 Thread Riyad Kalla
Good call -- going the intercept-and-stream route is great when you cannot read from a web-addressable folder, but if you can do that, and can avoid all that server-side processing by using a direct URL and just let the app server do it's thing, then +1 on that. Sounds like you got it going that

Re: images not under the context root directory

2010-01-28 Thread François Meillet
Thanks Ernesto, Jonas, Riyad, Don and Thomas. I implemented all of your solutions. I ended up with this one : 1) In the application init method I call this method, which add a directory to the WebApplicationPath private void initPath() { WebApplicationPath resourceFinder =

Re: images not under the context root directory

2010-01-28 Thread Riyad Kalla
Ernesto, Sorry about that -- I didn't mean to imply your impl was back, that was more directed at Francois along the lines of that's a lot of overhead, are you sure you need to do that? -- but now that I understand what his use-case is (saw his last reply about /usr/ext/img/IMAGES HERE) I get it.

Re: images not under the context root directory

2010-01-28 Thread Ernesto Reinaldo Barreiro
Hi Riyad, I didn't get offended by your message... which otherwise raised a very valid issue. Cheers, Ernesto On Thu, Jan 28, 2010 at 5:26 PM, Riyad Kalla rka...@gmail.com wrote: Ernesto, Sorry about that -- I didn't mean to imply your impl was back, that was more directed at Francois

images not under the context root directory

2010-01-27 Thread François Meillet
Hi Wicketers, I have a directory, /xxx/images with uploaded images, which is not under the application context root directory. How can I serve them as static images ? I tried the StaticImage class I found in the forum (http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 ) but it

Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
Just a couple of ideas... -Use a servlet to serve them? You don´t need Wicket for this... and combine this with simpleimage? -With Wicket mount a dynamic web-resource and combine this with simpleimage? Ernesto 2010/1/27 François Meillet fm...@meillet.com Hi Wicketers, I have a directory,

Re: images not under the context root directory

2010-01-27 Thread Don Ferguson
I used this suggestion to serve images out of a database, and it worked very well: http://dotev.blogspot.com/2009/11/serving-images-and-other-resources-with.html On Jan 27, 2010, at 5:56 AM, Ernesto Reinaldo Barreiro wrote: Just a couple of ideas... -Use a servlet to serve them? You don´t

Re: images not under the context root directory

2010-01-27 Thread Jonas
Have you tried the following: WebComponent image = new WebComponent(someWicketId); image.add(new SimpleAttributeModifier(src, http://.jpg;)); add(image); with markup img wicket:id=someWicketId / that should work just fine... if you cannot hardcode the image url, you can use the following

Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
this trick with the alias... I has done it mounting a dynamic WebResource and streaming back the contents myself. Like in here http://code.google.com/p/antilia/source/browse/trunk/com.antilia.demo.manager/src/com/antilia/demo/manager/img/MyImageMountedFactory.java Best, Ernesto On Wed,

Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
nice trick with the alias... was what I intended to say. On Wed, Jan 27, 2010 at 4:00 PM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: this trick with the alias... I has done it mounting a dynamic WebResource and streaming back the contents myself. Like in here

Re: images not under the context root directory

2010-01-27 Thread Thomas Kappler
On 01/27/10 15:57, Jonas wrote: Have you tried the following: WebComponent image = new WebComponent(someWicketId); image.add(new SimpleAttributeModifier(src, http://.jpg;)); add(image); with markup img wicket:id=someWicketId / that should work just fine... if you cannot hardcode the

Re: images not under the context root directory

2010-01-27 Thread François Meillet
Thank for yours posts. I try the solutions, but I can't figure out how to serve images as static images. F. Le 27 janv. 2010 à 16:10, Thomas Kappler a écrit : On 01/27/10 15:57, Jonas wrote: Have you tried the following: WebComponent image = new WebComponent(someWicketId); image.add(new

Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
Hi Francois, Following example works. 1-Create this class anywhere you want need. package com.antilia.demo.manager.img; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import

Re: images not under the context root directory

2010-01-27 Thread Riyad Kalla
This seems like adding a large amount of overhead to an image-heavy site (e.g. image blog or something), I thought I read in Wicket in Action that WicketFilter ignored HTTP requests for non-wicket resources now and passed them through to the underlying server to handle avoiding the need to remap

Re: images not under the context root directory

2010-01-27 Thread Ernesto Reinaldo Barreiro
Sure it is overhead but he wanted to serve images from a folder not under application context root directory... Then, you have to serve them somehow? The options I see are 1-A dedicated servlet? 2-With Wicket... and thats what the code shows... and for sure it can be done in a simpler way... A