Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355728

Summary: Replace Ajax request parameters with JSON
Product: [RT] RAP Reporter: Ralf Sternberg <rsternberg>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: mknauer, tbuschto
Version: 1.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: plan-version=2.0 plan-theme=alternative-clients plan-status=committed protocol
Bug Depends on: 387286, 388731    
Bug Blocks: 311355    

Description Ralf Sternberg CLA 2011-08-24 11:47:38 EDT
To migrate to the new protocol, we'll have to replace HTTP parameters in Ajax requests with JSON.
Comment 1 Tim Buschtoens CLA 2012-08-15 09:10:27 EDT
Added Writer.js to the client (commit ca327de6c2e6bea978960b379913d9c5eeeb3673). It's API is very similar to ProtocolMessageWriter.java. Currently it's not used anywhere.
Comment 2 Tim Buschtoens CLA 2012-08-28 10:26:59 EDT
With commit e445cbf95ad8657539a4b3b5c7920051ff39ae9a the writer (now ProtocolMessageWriter.js) is used to attach json to the ajax request, but the old form fields also still exist. Server ignores the json for now. Tests on client will have to be adapted before removing old form fields.

Additional issues:
* the TextSizeDetermination results don't follow the usual "id.property=value" format and can currently not be converted in a protocol-operation. Not sure what to do with that.
* The Server.js method "getParameter" is used in tests and have to be removed.
* The Server.js method "removeParameter" is used in Shell.js and has to be removed.
* Will we continue to URI-encode the post data after removoing the form fields?
Comment 3 Tim Buschtoens CLA 2012-09-03 07:09:38 EDT
With commit 61635afef86557f7d5595ae5248c53999bfe1a8a about half of the client tests have been adjusted to the client-to-server protcol. Also introduced ServerObject.js, which works in the same Manner as ClientObject.java.
Comment 4 Tim Buschtoens CLA 2012-09-03 10:44:02 EDT
It was actually much more than half. The remaining tests have been adapted:

commit be5b927eb7d4c532d64eb096d22e6ec0de1f5de7
commit 0c0104a94dd9e9b446d6efb3a88b2401bd9d2798
commit 8ee1e5342e4e5c3a86c4f7e662e148580365fa4b

Some further notes:

* In several places strings with json-like arrays are used to send data, i.e. "[1,2,3]". These should be actual arrays in the json. This happens at least in Grid (selection,cellChecked), EventUtil (modifier) and Browser (evaluate result).

* There are some cases of property names with "." in them. These should be renamed and possible grouped to be a json array/object. Concerns at least ScrolledComposite (selection) and Shell (bounds).

* Some events have questionable names, like "cellToolTipTextRequested". If there is a SWT counterpart, it should be named like that (SWT constant). Otherwise it might not be an event but a call.
Comment 5 Ivan Furnadjiev CLA 2012-09-04 03:36:55 EDT
The needed JSON API for Java classes has been added to the json source folder with commit 7d1915f89689cfc1902304444953bf4fb061cde5. All related license/notice/about files have been updated too.
Comment 6 Tim Buschtoens CLA 2012-09-05 11:59:04 EDT
commit 1fd39cf26aed6906443b2756ba0e7cdb3816ff3c fixed the BrowserHistory navigated event, which was not send in a notify but set operation.
Comment 7 Ivan Furnadjiev CLA 2012-09-10 09:48:12 EDT
Added server-side infrastructure for json-based client-to-server message with commit 7bda431ddd26087f77bbdd680d105c564019b38f. 
"Meta" properties "uiroot", "requestCounter" and "rwt_initialize" have been switched to the protocol with commits 830a644b68eda9bbf442de2b6c5c279594018d4d and 07e2f83815d928ebc056fe5ce0b267224255505c.
Comment 8 Ivan Furnadjiev CLA 2012-09-21 11:36:40 EDT
Switched all widgets to the protocol. Now client-to-server communication is json only.
Comment 9 Tim Buschtoens CLA 2012-09-26 05:18:14 EDT
For further tasks related to the client-to-server protocol see
Bug 390421 - [Protocol] Improve client-to-server protocol to take advantage of the new json format