Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MultipartConfig location no good  RSS feed

Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • 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
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:

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 "". That should imho be the default, not some undocumented absolute path named "".

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

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!