私は2つのサーバを持っています:1つはTomcat 6のウィンドウで、もう1つはJBoss 5 in Linuxです。文字セットをエンコードするTomcat Windows/JBoss Linux
ouputstreamにJSON(applicatio/json)を書き込むと、Tomcatでは特殊文字(Á、áなど)が得られますが、JBossでは間違っています。
これは私が右の出力ストリームにする方法である:...私は
httpresponse.setCharacterEncoding("utf-8");
と文字セットを強制した場合
protected void writeToOutputStream(String response, String tag) {
ServletOutputStream outputStream = null;
try {
logInfo("Writing to output stream");
outputStream = httpresponse.getOutputStream();
outputStream.write(response.getBytes(), 0, response.getBytes().length);
outputStream.flush();
} catch (IOException ex) {
logError("Could not write response into output stream", ex);
} finally {
try {
outputStream.close();
} catch (IOException ex) {}
}
}
それは、JBossではなく、Tomcatの中に[OK]を取得します
どのようにこれを解決するための任意のアイデア?
解決済み!私はgetBytesをダブルコールすることに気づいた。今私はちょうどそれをやっている、チップのおかげで! –