How to set WildFly 9.0.1.Final httpUri encoding - encoding

For the reason that I want to use JavaEE7 and JPA2.1, I turned to WildFly9.0.1 Final which meets my requirement.
WildFly9.0.1 Final is using undertow as the Web Server.
Chinese Characters(in UTF-8 encoding) from web browser transferred to the jboss Server turned TO Garbled words,below is the log:
2015-08-02 18:58:38,893 INFO com.gcable.action.people.people_type.PeopleTypeAction.printHttpRequest:76
- peopleTypes[0].pt_name=[Ljava.lang.String;#3e31e9ad[{│フテ¥ᄒᄋ│ミᄄ}]
I am going mad! God save me!
I have tried this in standalone.xml:
<servlet-container name="default" default-encoding="UTF-8">
But it doesn't work.
Also I have tried to add jboss-web.xml in WEB-INF in my deployed war:
<jboss-web version="9.0" xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/j2ee/schema/jboss-web_9_0.xsd">
<default-encoding>UTF-8</default-encoding>
It doesn't work too.

I solved the problem by setting the encoding in the http-listener of the standalone.xml (i use the standalone-full.xml but i guess it makes no difference)
<http-listener name="default" socket-binding="http" url-charset="ISO-8859-1"/>
Sorry for the late answer but i got the same problem today. Hope it will be helpful.

I finally tried to down-grade my JPA2.1 to 2.0.
Jboss EAP 6.2 perfectly encodes the none-english characters.
By the way,
I found sth here to make JBOSS EAP6 which in fact is a JavaEE6 Container to USE JPA2.1 instead of using 2.0

Related

What is the use of org.apache.struts.chain.ComposableRequestProcessor in struts and java.nio.charset.IllegalCharsetNameException

We ran into a migration issue where in we are migrating an application from JBoss 4.2.1.GA to JBoss EAP 7.0.0.GA. The exception encountered is as below.
java.lang.RuntimeException: java.nio.charset.IllegalCharsetNameException:
at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:226)
So we have a fix for the same which involves
Adding the below in the struts config.xml file.
this line in config
<controller processorClass="org.apache.struts.chain.ComposableRequestProcessor"
locale="true" nocache="false" contentType="text/html; charset= UTF8">
<set-property property="maxFileSize" value="7M"/>
</controller>
has been changes to
tag from charset= UTF8 to charset= ISO-8859-1"
and an additional property
This has resolved the issue but wants to know what is the proper use of class ComposableRequestProcessor. And why it is helping our solution here.
We don't see a proper document or blog on the net explaining why and when we need to add this configration. What is the advantage of doing so?
Also, we want to know JBoss 4.2.1.GA the page-context encoding was not enforced but in JBoss EAP 7.0.0.GA we need to define it as ISO else it won't work in windows server environment.
We know it has to do with some Undertow implementation over the earlier Apache Tomcat HTTPs implementation framework used by JBoss.
Any help by pointing to right document or information is widely appreciated.

How to remove KeyCloak from Wildfly?

I recently configured KeyCloak in my existing Wildfly server using the overlay installation:
bin/jboss-cli.sh --file=bin/keycloak-install.cli
I would like to remove it or disable it now. I'm pretty new to Wildfly. I think it should be the same way how to disable a subsystem?
The easiest way to achieve it will be to open standalone.xml file in the %JBossHome%>standalone>configuration folder and remove/comment out the keycloak subsystem.
The subsystem configuration will look something like this
<subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">
<web-context>auth</web-context>
</subsystem>

Unexpected element '{urn:jboss:domain:keycloak:1.0}subsystem

Happy New Year to all.
I have a keycloak/wildfly question.
I am attempting to secure my war for WildFly 9.0.2.Final deployment. I follow the directions in section 7.2.1 of http://docs.jboss.org/keycloak/docs/1.0.4.Final/userguide/pdf/keycloak-reference-guide-en-US.pdf
I get the error Unexpected element '{urn:jboss:domain:keycloak:1.0}subsystem
I have carefully followed each step as listed below.
cd $WILDFLY_HOME
unzip keycloak-wildfly-adapter-dist.zip
edit the standalone.xml and add the following:
<server xmlns="urn:jboss:domain:1.4">
<extensions>
<extension module="org.keycloak.keycloak-wildfly-subsystem"/>
...
</extensions>
<profile>
<subsystem xmlns="urn:jboss:domain:keycloak:1.0"/>
...
</profile>
It is the line subsystem xmlns="urn:jboss:domain:keycloak:1.0 that is flagged in the error.
What am I missing? Thank you in advance.
May be it's a little bit too late. I think the problem could be that you forget to merge modules, bins folder from key-cloak into Jboss, so that the container itself doesn't recognize the keycloak.

Set character encoding in jboss-web.xml

Is it possible to set character encoding for a JBoss AS 5.1 through a jboss-web.xml cfg file, like this?
<sun-web-app>
locale-charset-info default-locale="">
<locale-charset-map locale="" charset=""/>
<parameter-encoding default-charset="UTF-8"/>
</locale-charset-info>
</sun-web-app>
Thank you for your answers!
I see, your config sample is for GlassFish.
If you're still on JBoss AS 5.1, change:
<jboss_install>/server/(default)/deploy/jboss-web.deployer/server.xml
to set the connector URIEncoding:
<Connector port="8080" URIEncoding="UTF-8" />
If you're using a later version of JBoss AS or a different application server entirely, see my complete answer here.

Glassfish encoding

I'm using the code in this example example and in the runUpdate() function which i put in a javabean in a web application in Netbeans 6.8 with Glassfish v3.
It seems i have an encoding problem because question marks appear in the table.
I have tried so far:
In nbproject->private->private.properties add runtime.encoding=UTF-8>
In project->properties->sources->encoding utf-8
In program files->netbeans->etc->netbeans_conf in netbeans_default_options i add -J-DFile.encoding=UTF-8
In project->properties->build->compiling->additional compiler options -encoding utf-8
In sun-web.xml i added <locale-charset-info default-locale="UTF-8">
<locale-charset-map locale="" charset=""/>
<parameter-encoding default-charset="UTF-8"/>
</locale-charset-info>
Also when i use system.out.print() in the glassfish output panel i get gibberish.
I'm in the last level of madness please take a look.
Thank you.
EDIT
Also when i do listing .5 i get a glassfish error:
WARNING: WEB0500: default-locale attribute of locale-charset-info element is being ignored
Have you tried using glassfish-web.xml instead of sun-web.xml ?
To change default Glassfish POST fields encoding, I put this to WEB-INF/glassfish-web.xml, and it worked (I use glassfish 3.1.2):
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD
GlassFish Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<parameter-encoding default-charset="UTF-8" />
</glassfish-web-app>
I'm not sure if it will help you, but may help other people having the same problem as me.
Glassfish uses ISO-8859-1 encoding by default. See http://download.oracle.com/docs/cd/E19798-01/821-1752/beafu/index.html for more information.
Are you sure your browser is set to UTF-8. By default most browsers do not display in UTF.
Start with the browser and work backwards. Is your datasource storing the data in UTF-8? By default Java is in UTF-8 so I am not sure that GF is your real issue.