| Issue 16: | ComplexPlace JSON exception & questions about Places in guit | |
| 1 person starred this issue and may be notified of changes. | Back to list |
ComplexPlace JSON exception:
If you take link for example from demo:
http://localhost/demo/#!complex|{"Text":"Goodbye" "Enabled":false, "Color":"red", "TextSize":25}
and disrupt its integrity, for example:
http://localhost/demo/#!complex|{"Text":"Goodbye""Enabled":false "Color":"red", "TextSize":25}
then on output obtain following exception:
uncaught exception: com.google.gwt.json.client.JSONException: com.google.gwt.core.client.JavaScriptException: (SyntaxError): missing } after property list stack: eval("({\"Text\":\"Hello\", \"Enabled\":false\"Color\":\"blue\", \"TextSize\":25})")@:0 yA("{\"Text\":\"Hello\", \"Enabled\":false\"Color\":\"blue\", \"TextSize\":25}")@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1914 Dhb([object Object],"!complex|{\"Text\":\"Hello\", \"Enabled\":false\"Color\":\"blue\", \"TextSize\":25}")@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1956 Ghb([object Object])@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1092 Xu([object Object])@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:931 Nv([object Object],[object Object],false)@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1916 rv([object Object],[object Object])@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1806 IQ([object Object])@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:805 Yu([object Object],"!complex|{\"Text\":\"Hello\", \"Enabled\":false\"Color\":\"blue\", \"TextSize\":25}")@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1332 XO()@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1550 RI()@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1964 Ck(RI,[object XPCCrossOriginWrapper],[object Object])@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1627 ()@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1414 gwtOnLoad((void 0),"demo","http://localhost/demo/demo/")@http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1700 z()@http://localhost/demo/demo/demo.nocache.js:2 ()@http://localhost/demo/demo/demo.nocache.js:9 @http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html:1996 fileName: http://localhost/demo/demo/FB170F343994132CF8A461A3EC97E911.cache.html lineNumber: 1914
Questions:
1. How to change link type:
http://localhost/demo/#!complex|{"Text":"Goodbye" "Enabled":false, "Color":"red", "TextSize":25}
to link type:
http://localhost/demo/#complex?Text=Goodbye&Enabled=false&Color=red&TextSize=25
or:
http://localhost/demo/#complex?values#Text=Goodbye&Enabled=false&Color=red&TextSize=25
?
2. Example GWT form in browser:
-----------------------------------------------------------------------
| (menu) | <tab1(current)> | <tab2> |
-----------------------------------------------------------------------
| button1 | [window1 {textbox1}] [window2 {textbox1(focused by user)}]|
| button2 | |
-----------------------------------------------------------------------
where 1, 2 - item IDs. Item tab2 also have items [window1] and [window2].
How by means Place make following: when button2 clicked in browser link type becomes following - http://localhost/#!desktop?tab=2&window=1&textbox=1 and GWT would show following form:
-----------------------------------------------------------------------
| (menu) | <tab1> | <tab2(current)> |
-----------------------------------------------------------------------
| button1 | [window1 {textbox1(focused by user)}] [window2 {textbox1}]|
| button2 | |
-----------------------------------------------------------------------
?
Thanks in advance.
Sep 15, 2010
(No comment was entered for this change.)
Status:
Fixed
Sep 15, 2010
Maybe use some encrypt/decrypt operation to hide json string in url?
Sep 15, 2010
Thats actually a really good idea! I will make a new issue. |
Hi, The JsonException should never happen on production, it should go to the default place if there's any (I will fix that). In development mode is ok to get the exception. 1. The token is a json encoded string. Thats why it won't get any prettier. The place implementation in guit is focused in being able to store any kind of data in that token instead of trying to get a user-friendly token. 2. As I said, you can store any kind of data in your places. So you can make a pojo like this: public class DesktopState { ptivate int tab; ptivate int window; ptivate int textbox; // Getters and Setters (important) } public DesktopPresenter ...... implements Place<DesktopState> { ..... }