From 961f785060f749ed97b0516745cb9ad2fd2704cc Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 30 Sep 2016 09:22:29 +0200 Subject: refactor http servlet response processing to prohibit 'chunked' transfer encoding --- .../id/auth/frontend/builder/GUIFormBuilderImpl.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'id/server/moa-id-frontend-resources/src') diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/GUIFormBuilderImpl.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/GUIFormBuilderImpl.java index 26b37226d..e77933986 100644 --- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/GUIFormBuilderImpl.java +++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/GUIFormBuilderImpl.java @@ -101,11 +101,23 @@ public class GUIFormBuilderImpl implements IGUIFormBuilder { //evaluate template StringWriter writer = new StringWriter(); engine.evaluate(context, writer, loggerName, new BufferedReader(new InputStreamReader(is))); - + //write template to response + final byte[] content = writer.toString().getBytes("UTF-8"); httpResp.setStatus(HttpServletResponse.SC_OK); - httpResp.setContentType(contentType); - httpResp.getOutputStream().write(writer.toString().getBytes("UTF-8")); + httpResp.setContentLength(content.length); + httpResp.setContentType(contentType); + httpResp.getOutputStream().write(content); + + if (Logger.isTraceEnabled()) { + Logger.trace("Write Content for viewName:" + viewName + + ". Contentsize:" + String.valueOf(content.length) + + " BufferSize:" + httpResp.getBufferSize() + + " ContentType:" + contentType); + for (String el : httpResp.getHeaderNames()) + Logger.trace(" * Headername:" + el + " Value:" + httpResp.getHeader(el)); + + } } catch (IOException e) { Logger.error("GUI form-builder has an internal error.", e); -- cgit v1.2.3