Issue Details (XML | Word | Printable)

Key: JAX_RS_SPEC-399
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: beryozkin_sergey
Votes: 1
Watchers: 0

If you were logged in you would be able to see more operations.

Remove the specification requirement to have a pre-packaged MessageBodyReader for File

Created: 25/Apr/13 03:09 PM   Updated: 18/Jun/13 12:38 PM
Component/s: spec
Affects Version/s: 2.0
Fix Version/s: ice box

Time Tracking:
Not Specified

Participants: beryozkin_sergey and mkarg

 Description  « Hide

The specification requires supporting reading File objects out of the box.
Proposal: drop this requirement as supporting it requires for the runtime to create a temporarily file on the disk for every request, and also copy the payload to the disk on every request. The implementations which already support reading File can continue to do so, this JIRA is really about not enforcing this requirement at the spec level.

mkarg added a comment - 01/May/13 08:05 AM

Actually you can implement subclasses which do not store anything on the local file System at all. I did this many times in the past as adapters between based APIs and database-stored content. In fact, technically there is nothing in the API which really enforces the use of a physical HDD-stored file.

beryozkin_sergey added a comment - 01/May/13 09:31 AM

Right, I've obviously have not done that before - so I'll take my comments off about having to save the data to the disk for now.

What happens then if the user code calls File.toURI(), we don't have a guarantee that the user immediately calls "new FileInputStream(File)" or submits this File object immediately to some DB-aware layer ?