views:

85

answers:

2

Hi, It makes sense to return data when a form is submitted using post method. It looks as if only html/text can be returned ordinarily... I use gwt on the client side and it does not seem to work properly if plain/text is returned.

The question: how safe is to return all kind of text using html/text? Is it possible that some data could break gwt or formpanel? Also, how safe is to return something json format?

I guess it is not safe to return binary data in that way. I have not tried.

A: 

It depends on what protocol you are using. GWT can use GWT RPC, SOAP, XMLRPC, JSON or almost anything. I don't see why it would not be safe to return text/html content type.

Don't use eval() for JSON in your javascript unless it is a server you trust. There are javascript JSON parsers available which are safer and faster than eval(). It is expected that native JSON parser support will be included in the next ECMAScript standard.

To send binary data, it might be best that you base64 encode it.

Sean A.O. Harney
A: 

IT is not safe to return text/html type because it seems to change the data if one does not know what changes.

On the client side, it noticed that -multiple space become one space -tabs disappeared -<> changed into < and >

Aftershock