Tuesday, November 27, 2012

Re: Sending HTML as JSON with RequestBuilder



On Tuesday, November 27, 2012 5:30:08 PM UTC+1, Milan Cvejic wrote:
Thanks guys for help, I forgot to mention that json gets properly
encoded if using

RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
        builder.setHeader("Content-Type", "application/json");

but in my case i need request to be sent as
application/x-www-form-urlencoded or as text/html.

Ah, so you need an extra level of escaping: URL.encodeURIComponent for applicationx-www-form-urlencoded, or SafeHtmlUtils for text/html (that one really depends how you're processing the data on the server side).

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/sJwuB_k20DUJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment