Re: Different root between upload folder and ContextRelativeResource

2012-12-30 Thread Delange
Thanks for answering.

I follewed the link, but I must admit that I still struggle with the
example.
I do not know enough of BufferedImage, OutputStream etc to know what I need
to change.
Hope you can describe what I need to change in order to download images.

Thans in advance!




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Different-root-between-upload-folder-and-ContextRelativeResource-tp4655089p4655102.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Different root between upload folder and ContextRelativeResource

2012-12-28 Thread Martin Grigorov
Hi,

ContextRelativeResource looks for the resource in the web application
context, i.e. in the folders next to WEB-INF.
By using new File()/Folder() with relative path you create file relative to
the current working directory. In Eclipse this is the folder that contains
'src/' folder. When deployed this depends on the used web container. Use :
System.err.println(CWD:  + new java.io.File(.).toAbsolutePath()); to
see what it is exactly.

In the other thread I suggested you to use ByteArrayResource instead. See
http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ for
example.


On Fri, Dec 28, 2012 at 1:16 AM, Delange delan...@telfort.nl wrote:

 I have an application which can upload pictures.
 When I use the upload with Jetty in my Eclipse directory it stores all
 pictures under
 eclipseproject
 /images
 /src/main/webapp/images

 But if i want to display them with ContextRelativeResource then they must
 be
 in /src/main/webapp/images

 Upload command is
 Folder uploadFolder = new Folder(opdrachten/+input.getOpdrachtnummer(),
 );

 for display i use
 String picture =
 opdrachten/+opdracht.getOpdrachtnummer()+/+file.getName();
 logger.info(picture);
 Image image2 = new Image(image2,new
 ContextRelativeResource(picture));
 What is wrong?




 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Different-root-between-upload-folder-and-ContextRelativeResource-tp4655089.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/