• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MultipartConfig location no good

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It appears that there's something fundamentally wrong with the new @MultipartConfig annotation.

The documentation says nothing about where temporary files are stored. All the javadoc
http://docs.oracle.com/javaee/6/api/javax/servlet/annotation/MultipartConfig.html#location()
has to say is:

The directory location where files will be stored. Default:""


Huh? What, exactly, is the location "" ?? Root? Current path?

And the JEE 6 tutorial is not terribly helpful either:
http://docs.oracle.com/javaee/6/tutorial/doc/gmhal.html

location: An absolute path to a directory on the file system. The location attribute does not support a path relative to the application context. This location is used to store files temporarily while the parts are processed or when the size of the file exceeds the specified fileSizeThreshold setting. The default location is "".


Not terribly illuminating.

Now, suppose that this directory can't be written to. Then the servlet won't work. Or suppose that the directory is unsuitable for some other reason. Then the programmer can hard-code a path using the location attribute. But hold on: the webapp may need to run on different platforms (say, Unix and Windows). Then the temp directory must be configurable. But that can't be done using the @MultiPart annotation (afaik). Eek!

A sensible catalog would be to use the System Property "java.io.tmpdir". That should imho be the default, not some undocumented absolute path named "".

Is there any way of setting location to ${java.io.tmpdir} ??
If not, shouldn't the applicable JSR be amended?


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic