How to set the charset with JAX-RS?

后端 未结 7 1114
时光说笑
时光说笑 2020-12-08 09:30

How can I set the charset with JAX-RS? I\'ve tried @Produces(\"text/html; charset=UTF-8\") but that was ignored and only text/html was send with th

7条回答
  •  不知归路
    2020-12-08 10:02

    As Daemon pointed out in a comment, the latest versions of JAX-RS (including the stable version as of September 2012) now do support the @Produces syntax. So you can just use:

    @Produces("text/html; charset=UTF-8")
    

提交回复
热议问题