2009/6/22 Jantek Balázs <
bjantek@...>
> Hi!
>
> I would like to ask if it is possible to configure
> a fileItemFactory so that it never uses the file system.
>
> I would need a kind of MemoryFileItemFactory.. :-)
That's probably your best bet, if you really want to *never* use the file
system. That is, write a MemoryFileItemFactory and configure FileUpload to
use that.
>
> My problem is that my webapp has no access to the file system.
> If i set a large threshold on a DefaultFileItemFactory of
> a DiskFileItemFactory, i always get permission exceptions.
I don't know why you would be getting permission exceptions if your files
are always below the size threshold you set. The only possibility I see is
that the servlet container is causing this, in which case I'm not sure
there's anything you would be able to do about it. You'd have to debug /
look at the stack trace to find out where the exception is coming from.
I also don't know why you are setting a repository if you don't ever expect
your uploads to be written to file. If you set the size threshold suitably
high and don't set a repository, you shouldn't have any problems (modulo the
container itself, as mentioned above).
--
Martin Cooper
> I would like to separate the uploaded small (xml) files so
> that my servlet doesn't hit the file system.
>
> Do you have any ideas?
>
> Thanks!
>
> jb
>
> **********
>
> DiskFileItemFactory factory = new DiskFileItemFactory();
>
> // Set factory constraints
> factory.setSizeThreshold(1024 * 1024);
> factory.setRepository(new File("tempfile.tmp"));
>
> // Create a new file upload handler
> ServletFileUpload upload = new
> ServletFileUpload(factory);
>
> try {
> List items = upload.parseRequest(request);
> // PERMISSION EXCEPTION HERE
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
user-unsubscribe@...
> For additional commands, e-mail:
user-help@...
>
>