It is an application that has been built using seam 2.2 and it is running perfectly under Jboss 4.1.2. Because of support from my ISP I will have to upgrade JBoss to version 5.1 . I did try to run same app under JBoss 5 and everything looked fine but one single thing failed.
It is a piece of code that generates some JSon to feed a Chart built using Open Flash Chart libraries. I also use JOFC libraries to generate the JSon for these charts. Well the approach we have used basically has a seam factory which prints a JSon and than we do reference this factory in a blank .xhtml page from where the chart loads the required JSon to render properly. Follow some snippets:
The xhtml page where the seam factory gets called:
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
contentType="text/json; charset=UTF-8">
#{jsonGraficoPesoUsuario}
</f:view>
The factory method which generates the JSon string:
@Factory("jsonGraficoPesoUsuario")
public String graficoPesoUsuario()
{
...
String jsonString = chart.toString();
log.info("JSonString ==>> " + jsonString);
// try {
// jsonString = URLEncoder.encode(jsonString, "UTF-8");
// } catch (UnsupportedEncodingException e) {
// log.error("Erro ao tentar fazer o encode da string json ==>> " + e.getMessage());
// e.printStackTrace();
// }
return jsonString;
Well the code shows also that we have tryied encoding the json string before sending but again no success. In the line where it is printed json to log.info the json string is perfectly preserved, but using JBoss5 what happens is that the " (double quote) chars are replaced by html escape characters.
The follow json string is expected to properly feed the chart and this behaves correctly under jboss4:
{"y_axis":{"min":100,"colour":"#96A9C5","grid-colour":"#DDDEE1","max":112},"title":{"text"
:"Gráfico de evolução de Peso"},"bg_colour":"#FFFFFF","is_decimal_separator_comma":1,"elements":[{"text":"Peso","values":[100.5,101.5,102.5,
102,103,107,109,110.5,108],"font-size":10,"type":"line","tip":"Linha do Peso"}],"num_decimals":2,"is_fixed_num_decimals_forced":1,"x_axis":{
"colour":"#96A9C5","grid-colour":"#DDDEE1","labels":{"rotate":"-24","labels":["01/05/10","15/05/10","25/05/10","01/06/10","09/06/10","25/06/
10","05/07/10","10/07/10","20/07/10"]}},"is_thousand_separator_disabled":0}
But than using JBoss5 the follow string is printed, notice the html encode replacement for double quotes:
{"y_axis":{"min":100,"colour":"#96A9C5","grid-colour":"#DDDEE1","max":112},"title":{"text":"Gráfico de evolução de Peso"},"bg_colour":"#FFFFFF","is_decimal_separator_comma":1,"elements":[{"text":"Peso","values":[100.5,101.5,102.5,102,103,107,109,110.5,108],"font-size":10,"type":"line","tip":"Linha do Peso"}],"num_decimals":2,"is_fixed_num_decimals_forced":1,"x_axis":{"colour":"#96A9C5","grid-colour":"#DDDEE1","labels":{"rotate":"-24","labels":["01/05/10","15/05/10","25/05/10","01/06/10","09/06/10","25/06/10","05/07/10","10/07/10","20/07/10"]}},"is_thousand_separator_disabled":0}
I have already checked O.S locale and also did a configuration on jboss http channel to encode the body in server.xml:
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443" useBodyEncodingForURI="true"/>
It didn't work. We use UTF-8 for all resources and pages in our app.
Any clues?
Tx in advance. []s
I took a look at jsf documentation to review it and found f:verbatim tag. It fixed the issue. Now my .xhtml page where the json string is printed is like:
Now the result json string is not changed and the graphic renders properly.
[]s