Created
June 17, 2013 13:04
-
-
Save kramer/5796703 to your computer and use it in GitHub Desktop.
setting default encoding for content returned with responseBody annotation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mvc:annotation-driven> | |
<!-- register custom converter that returns UTF-8 encoded response-body by 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> | |
. | |
. | |
. | |
<context:component-scan base-package="com.sample.rest"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping(produces = MediaType.APPLICATION_XML_VALUE) | |
@ResponseBody | |
public String getXml() { | |
awesomeService.getSpectacularXml() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment