简体   繁体   English

JBoss Linux中的Spring MVC字符编码

[英]Spring mvc character encoding in jboss linux

I send this query string in my windows tomcat 我在Windows tomcat中发送此查询字符串

/app/search/?destinationName=Canc%C3%BAn%2CMexico / app / search /?destinationName = Canc%C3%BAn%2CMexico

    @RequestMapping(value = "/search", method = { RequestMethod.GET, 
                                                RequestMethod.POST  })
    public String search(
     @RequestParam(value = "destinationName", required = false) String 
                  destinationName,
     BindingResult bindingResult, HttpServletRequest request) throws     
                          IOException,ParseException {

a break point at the controller in windows tomcat will show this: Cancún, Mexico Windows tomcat中控制器的断点将显示以下内容:墨西哥坎昆

a break point at the controller in linux jboss will show this: Cancún, mexico linux jboss中控制器的断点将显示以下内容:墨西哥坎昆

I have tried: 我努力了:

@Bean
public FilterRegistrationBean utfFilter() {         CharacterEncodingFilter filter = new 
CharacterEncodingFilter();
filter.setEncoding("UTF-8");
FilterRegistrationBean registrationBean = new 
FilterRegistrationBean();
        registrationBean.setFilter(filter);
        registrationBean.addUrlPatterns("/*");
        return registrationBean;
    }

but that has not fixed the encoding problem at jboss linux 但这并没有解决jboss linux的编码问题

any hint? 有什么提示吗?

for my jboss red hat 6.4 problem fixed by adding this to standalone.xml 通过将其添加到standalone.xml中来解决我的jboss red hat 6.4问题

<system-properties>
    <!-- URI Properties -->
    <property name="org.apache.catalina.connector.URI_ENCODING"         value="UTF-8"/>
        <property     name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING"         value="true"/>
    </system-properties>

hint taken from: https://developer.jboss.org/message/643825#643825 提示来自: https : //developer.jboss.org/message/643825#643825

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM