Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
146 views
in Technique[技术] by (71.8m points)

java - JBOSS 7 encoding not working as expected

I had problems with my listgrids not showing diacritcs corectly and I found out that when I inserted from java into the db the values where already bugged.

A post here helped and I changed my project properties -> Text encoding -> other -> UTF-8 and this fixed my problem. Thing is this only fixes my problem locally.

What I need to do is on my Jboss server also set the encoding somehow. This is what I put in my configuration file:

    <?xml version='1.0' encoding='UTF-8'?>

<server name="vali-ubuntu" xmlns="urn:jboss:domain:1.0">
    extensions>
        extension module="org.jboss.as.clustering.infinispan"/>
        extension module="org.jboss.as.connector"/>
        extension module="org.jboss.as.deployment-scanner"/>
        extension module="org.jboss.as.ee"/>
        extension module="org.jboss.as.ejb3"/>
        extension module="org.jboss.as.jaxrs"/>
        extension module="org.jboss.as.jmx"/>
        extension module="org.jboss.as.logging"/>
        extension module="org.jboss.as.naming"/>
        extension module="org.jboss.as.osgi"/>
        extension module="org.jboss.as.remoting"/>
        extension module="org.jboss.as.sar"/>
        extension module="org.jboss.as.security"/>
        extension module="org.jboss.as.threads"/>
        extension module="org.jboss.as.transactions"/>
        extension module="org.jboss.as.web"/>
        extension module="org.jboss.as.weld"/>
    /extensions>
     system-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="tru
e"/>
    /system-properties>

//.....

This doesn't work so maybe I need to add something else. I tried everything I could find with no succes so any help is appreciated. Thanks.

EDIT:From what I read, this will work only in jboss 7.1.0 beta 1 or highier. (URIEncoding) and I use JBoss 7.0.2 so I need a replacement for 7.0.2

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

for jboss-as-7.1.1.Final i added this line to standalone.conf, this file lives under the directory bin:

JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.connector.URI_ENCODING=UTF-8"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...