diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-09-30 09:22:29 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-10-07 07:44:58 +0200 |
commit | 961f785060f749ed97b0516745cb9ad2fd2704cc (patch) | |
tree | 23c10876368166f1e65a6719d31ae81784d54b8f /id/server/modules/moa-id-module-openID/src/main | |
parent | 58c843aa630c1e6fd2680cf019f7e270abbe9a69 (diff) | |
download | moa-id-spss-961f785060f749ed97b0516745cb9ad2fd2704cc.tar.gz moa-id-spss-961f785060f749ed97b0516745cb9ad2fd2704cc.tar.bz2 moa-id-spss-961f785060f749ed97b0516745cb9ad2fd2704cc.zip |
refactor http servlet response processing to prohibit 'chunked' transfer encoding
Diffstat (limited to 'id/server/modules/moa-id-module-openID/src/main')
2 files changed, 9 insertions, 9 deletions
diff --git a/id/server/modules/moa-id-module-openID/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/protocol/OAuth20Protocol.java b/id/server/modules/moa-id-module-openID/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/protocol/OAuth20Protocol.java index e6ccc67b7..118c53f6b 100644 --- a/id/server/modules/moa-id-module-openID/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/protocol/OAuth20Protocol.java +++ b/id/server/modules/moa-id-module-openID/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/protocol/OAuth20Protocol.java @@ -225,14 +225,14 @@ public class OAuth20Protocol extends AbstractAuthProtocolModulController { // create response JsonObject jsonObject = new JsonObject(); OAuth20Util.addProperytiesToJsonObject(jsonObject, params); - String jsonResponse = jsonObject.toString(); - Logger.debug("JSON Response: " + jsonResponse); + byte[] jsonResponse = jsonObject.toString().getBytes("UTF-8"); + Logger.debug("JSON Response: " + new String(jsonResponse)); // write respone to http response response.setContentType("application/json"); + response.setContentLength(jsonResponse.length); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - response.getOutputStream().print(jsonResponse); - response.getOutputStream().close(); + response.getOutputStream().write(jsonResponse); return true; } diff --git a/id/server/modules/moa-id-module-openID/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/protocol/OAuth20TokenAction.java b/id/server/modules/moa-id-module-openID/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/protocol/OAuth20TokenAction.java index 9d78418cd..985e1d1c5 100644 --- a/id/server/modules/moa-id-module-openID/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/protocol/OAuth20TokenAction.java +++ b/id/server/modules/moa-id-module-openID/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/protocol/OAuth20TokenAction.java @@ -83,14 +83,14 @@ class OAuth20TokenAction implements IAction { // create response JsonObject jsonObject = new JsonObject(); OAuth20Util.addProperytiesToJsonObject(jsonObject, auth20SessionObject.getAuthDataSession()); - String jsonResponse = jsonObject.toString(); - Logger.debug("JSON Response: " + jsonResponse); + byte[] jsonResponse = jsonObject.toString().getBytes("UTF-8"); + Logger.debug("JSON Response: " + new String(jsonResponse)); // write respone to http response httpResp.setContentType("application/json"); - httpResp.setStatus(HttpServletResponse.SC_OK); - httpResp.getOutputStream().print(jsonResponse); - httpResp.getOutputStream().close(); + httpResp.setContentLength(jsonResponse.length); + httpResp.setStatus(HttpServletResponse.SC_OK); + httpResp.getOutputStream().write(jsonResponse); return null; } |