Re: wicket file upload

2010-05-29 Thread mdh

I don't know about google app engine. The hosting service I'm with uses
tomcat 6.0.x.

However, the software you attached showed me what I needed to do. The bit I
had missed was overriding newWebRequest in my web application. It was
obvious once it had been pointed out to me!

I've not tried it yet, but upgrading to a later version with the
MultipartServletWebRequest constructor that takes a FileItemFactory, should
enable me to use mostly wicket code. I'll simply need to use the overriding
pattern shown in the previously mentioned software to call it.

Thanks.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-file-upload-tp2230621p2235813.html
Sent from the Wicket - User 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: wicket file upload

2010-05-27 Thread jbrookover

If this mysterious server environment happens to be Google App Engine, there
is already some code floating around (@author uudashr) that manages file
uploads seamlessly with the datastore.

Jake
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-file-upload-tp2230621p2233852.html
Sent from the Wicket - User 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: wicket file upload

2010-05-26 Thread mdh

create your own FileItemFactory that returns a DatabaseImageStorageFileItem 
(which you'll have to create).  When the request is processed, your 
DatabaseImageStorageFileItem 
will be created

I understand your idea, but I still have the problem of how do I make the
request use my FileItemFactory.

Looking at the code for MultipartServletWebRequest (which is the request
type used for a file upload) it hard codes the factory used (line 94 in
1.4.1):
   DiskFileItemFactory factory = new DiskFileItemFactory();

Does wicket provide some hook that I could use to insert my own
FileItemFactory, so that it will use that instead of the
DiskFileItemFactory? It might just be that I don't understand wicket well
enough and I'm looking in the wrong place.

I use FileUploadField on the form, but I can't see anything in there that
allows a factory to be specified.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-file-upload-tp2230621p2232247.html
Sent from the Wicket - User 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: wicket file upload

2010-05-26 Thread Jeremy Thomerson
On Wed, May 26, 2010 at 2:51 PM, mdh mhorn...@ntlworld.com wrote:


 create your own FileItemFactory that returns a
 DatabaseImageStorageFileItem
 (which you'll have to create).  When the request is processed, your
 DatabaseImageStorageFileItem
 will be created

 I understand your idea, but I still have the problem of how do I make the
 request use my FileItemFactory.

 Looking at the code for MultipartServletWebRequest (which is the request
 type used for a file upload) it hard codes the factory used (line 94 in
 1.4.1):
   DiskFileItemFactory factory = new DiskFileItemFactory();

 Does wicket provide some hook that I could use to insert my own
 FileItemFactory, so that it will use that instead of the
 DiskFileItemFactory? It might just be that I don't understand wicket well
 enough and I'm looking in the wrong place.

 I use FileUploadField on the form, but I can't see anything in there that
 allows a factory to be specified.
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/wicket-file-upload-tp2230621p2232247.html
 Sent from the Wicket - User 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


The latest 1.4.9 has a constructor in MultipartServletWebRequest that takes
a FileItemFactory.  I'm not sure how long that constructor has been there.

-- 
Jeremy Thomerson
http://www.wickettraining.com


wicket file upload

2010-05-25 Thread mdh

I am having a problem using FileUploadField in wicket 1.4.1.

The code behind this is writing a temporary file to java.io.tmpdir (see
getTempFile() in DiskFileItem).

The java hosting service I'm using doesn't grant access to the temp
directory, nor does it allow the changing of system properties, so I get a
security exception whenever I attempt a file upload.

DiskFileItem only uses java.io.tmpdir if the repository field is null. I
believe that DiskFileItemFactory is used to create DiskFileItem and set up
it's repository, and a DiskFileItemFactory is created in the constructor for
MultipartServletWebRequest.

So, I need a way of setting the repository, and in
MultipartServletWebRequest there is a comment that says Configure the
factory here, if desired (line 96 in version 1.4.1). But, the only way I
can see of configuring the factory so that it has the desired repository is
to edit the code.

Have I missed something? Is there a way of setting the repository without
editing the code? Have I got so deep into the code that I've missed the
obvious! Would the best way forward be to edit the code and request a change
in a future release?

I've had a look at 1.4.8 and it seems to have the same issue.

Thanks for your help,


Mark.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-file-upload-tp2230621p2230621.html
Sent from the Wicket - User 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: wicket file upload

2010-05-25 Thread Jeremy Thomerson
can you use write(File) instead of getTempFile()?

On Tue, May 25, 2010 at 2:59 PM, mdh mhorn...@ntlworld.com wrote:


 I am having a problem using FileUploadField in wicket 1.4.1.

 The code behind this is writing a temporary file to java.io.tmpdir (see
 getTempFile() in DiskFileItem).

 The java hosting service I'm using doesn't grant access to the temp
 directory, nor does it allow the changing of system properties, so I get a
 security exception whenever I attempt a file upload.

 DiskFileItem only uses java.io.tmpdir if the repository field is null. I
 believe that DiskFileItemFactory is used to create DiskFileItem and set up
 it's repository, and a DiskFileItemFactory is created in the constructor
 for
 MultipartServletWebRequest.

 So, I need a way of setting the repository, and in
 MultipartServletWebRequest there is a comment that says Configure the
 factory here, if desired (line 96 in version 1.4.1). But, the only way I
 can see of configuring the factory so that it has the desired repository is
 to edit the code.

 Have I missed something? Is there a way of setting the repository without
 editing the code? Have I got so deep into the code that I've missed the
 obvious! Would the best way forward be to edit the code and request a
 change
 in a future release?

 I've had a look at 1.4.8 and it seems to have the same issue.

 Thanks for your help,


 Mark.
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/wicket-file-upload-tp2230621p2230621.html
 Sent from the Wicket - User 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




-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: wicket file upload

2010-05-25 Thread mdh

What I'm actually doing is importing an image into a database. My code opens
an input stream on the file selected by the user
(FileUploadField.getFileUpload().getInputStream()) , and uses that to create
a blob in the database.

I don't do any file writing in my code, that's done in the background by the
wicket code. I don't think I can stop the wicket code doing this, and I
don't think I should as it seems to use temporary files as part of the
upload process. 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-file-upload-tp2230621p2230746.html
Sent from the Wicket - User 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: wicket file upload

2010-05-25 Thread Jeremy Thomerson
create your own FileItemFactory that returns a DatabaseImageStorageFileItem
(which you'll have to create).  When the request is processed, your
DatabaseImageStorageFileItem
will be created, and then getOutputStream will be called, which you should
use to return a stream that will write into the database (or, temporarily
into memory, later to be saved).  I've never had to do this, so I can't be a
whole lot more help, but that should get you going.

On Tue, May 25, 2010 at 4:27 PM, mdh mhorn...@ntlworld.com wrote:


 What I'm actually doing is importing an image into a database. My code
 opens
 an input stream on the file selected by the user
 (FileUploadField.getFileUpload().getInputStream()) , and uses that to
 create
 a blob in the database.

 I don't do any file writing in my code, that's done in the background by
 the
 wicket code. I don't think I can stop the wicket code doing this, and I
 don't think I should as it seems to use temporary files as part of the
 upload process.
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/wicket-file-upload-tp2230621p2230746.html
 Sent from the Wicket - User 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




-- 
Jeremy Thomerson
http://www.wickettraining.com