java - Spring @response body with defferent alphabet return bad results -
java - Spring @response body with defferent alphabet return bad results -
i have spring method using @responsebody annotation, when ever resonse body has hebrew alphabet response shown in client distorted. changed stringhttpmessageconverter charset utf-8 still result same.
what can do?
@requestmapping(method = requestmethod.post, value = {"/{accountid}/{containerid}/{objectid:.+}"}) public @responsebody string createobject( @pathvariable string accountid, @pathvariable string containerid, @pathvariable string objectid, httpservletrequest request, httpservletresponse response) <mvc:annotation-driven> <!-- register custom converter returns utf-8 encoded response-body defualt --> <mvc:message-converters register-defaults="true"> <bean class="org.springframework.http.converter.stringhttpmessageconverter"> <constructor-arg index="0" name="defaultcharset" value="utf-8"/> </bean> </mvc:message-converters> </mvc:annotation-driven>
your @requestmapping
annotation should define attribute produces
:
@requestmapping(method = requestmethod.post, value = {"/{accountid}/{containerid}/{objectid:.+}"}, , produces = "text/plain;charset=utf-8")
otherwise uses default encoding of server not utf-8
.
java spring httpresponse
Comments
Post a Comment