java - Set default encoding for Undertow embedded -
i'm using undertow embedded http server in app. default encoding iso-8859-1
url encoding , query parameters. want use utf-8
. did not find in documentation. idea?
i setup defaultencoding
on deploynentinfo. helped me.
deploymentinfo servletbuilder = servlets .deployment() .setclassloader(main.class.getclassloader()) .setdeploymentname("myapp").setcontextpath("/myapp") .setdefaultencoding("utf-8"); deploymentmanager manager = servlets.defaultcontainer().adddeployment(servletbuilder); manager.deploy(); undertow server = undertow.builder() .addhttplistener(9090, "localhost") .sethandler(manager.start()) .build(); server.start();
for current version of undertow default encoding utf-8. non-deploy mode, can use options change default encoding:
undertow.builder() .sethandler(...) .setserveroption(undertowoptions.url_charset, "utf8") .addhttplistener(port, host) .build() .start();
Comments
Post a Comment