Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334701 - [server] Preference PUT format does not scale
Summary: [server] Preference PUT format does not scale
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.2   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-18 15:46 EST by John Arthorne CLA
Modified: 2011-09-01 11:41 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2011-01-18 15:46:43 EST
Our current REST API for preferences does this to change a single value:

PUT /prefs/user/myprefs?key=Name&value=Gilgamesh

However this puts a severe limit on the size of the preference value, since it must be encoded directly in the request URL. We should support a different format that puts the preference value in the request body:

----
PUT /prefs/user/myprefs?key=Name

Very larger value goes here...
-----
Comment 1 John Arthorne CLA 2011-01-18 15:48:53 EST
For PreferencesServlet:

private String getBodyAsString(HttpServletRequest req) throws IOException {
		StringWriter writer = new StringWriter();
		IOUtilities.pipe(req.getReader(), writer, true, false);
		return writer.toString();
	}
Comment 2 John Arthorne CLA 2011-02-03 16:32:47 EST
Fixed. Putting a single value now uses a form-encoded request body, which is more standard for PUT operations.
PUT /prefs/user/myprefs
Orion-Version: 1.0
Content-Length: 21
Content-Type: "application/x-www-form-urlencoded"

key=Name&value=Enkidu
Comment 3 Simon Kaegi CLA 2011-02-03 17:49:25 EST
Hmm... is that a complete representation of /prefs/user/myprefs or just a PATCH?
Comment 4 John Arthorne CLA 2011-02-04 09:43:08 EST
(In reply to comment #3)
> Hmm... is that a complete representation of /prefs/user/myprefs or just a
> PATCH?

It is just a single key/value. This can also be expressed as the following if you prefer this equivalent syntax:

PUT /prefs/user/myprefs?key=Name

value=Frodo