You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:12:52 UTC

[sling-org-apache-sling-scripting-thymeleaf] 09/27: SLING-4297 SLING-4298 align usage

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-0.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git

commit b403330e5003f24dee65aa22cbe8ac91b1638d0d
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Jan 16 07:44:23 2015 +0000

    SLING-4297 SLING-4298 align usage
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/thymeleaf@1652354 13f79535-47bb-0310-9956-ffa450edef68
---
 .../internal/processor/attr/SlingIncludeAttrProcessor.java    | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingIncludeAttrProcessor.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingIncludeAttrProcessor.java
index 39214ae..4833ae8 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingIncludeAttrProcessor.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/processor/attr/SlingIncludeAttrProcessor.java
@@ -23,14 +23,12 @@ import java.io.IOException;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletException;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.request.RequestDispatcherOptions;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.api.resource.SyntheticResource;
-import org.apache.sling.scripting.core.servlet.BufferedServletOutputStream;
 import org.apache.sling.scripting.core.servlet.CaptureResponseWrapper;
 import org.apache.sling.scripting.thymeleaf.internal.SlingWebContext;
 import org.apache.sling.scripting.thymeleaf.internal.dom.NodeUtil;
@@ -137,19 +135,14 @@ public class SlingIncludeAttrProcessor extends AbstractAttrProcessor {
             }
 
             if (dispatcher != null) {
-                final String encoding = slingHttpServletResponse.getCharacterEncoding();
-                final BufferedServletOutputStream bsos = new BufferedServletOutputStream(encoding);
                 try {
-                    final CaptureResponseWrapper wrapper = new CaptureResponseWrapper(slingHttpServletResponse, bsos);
+                    final CaptureResponseWrapper wrapper = new CaptureResponseWrapper(slingHttpServletResponse);
                     dispatcher.include(slingHttpServletRequest, wrapper);
                     if (!wrapper.isBinaryResponse()) {
-                        wrapper.flushBuffer();
-                        return bsos.getBuffer();
+                        return wrapper.getCapturedCharacterResponse();
                     }
                 } catch (ServletException e) {
                     logger.error(e.getMessage(), e);
-                } finally {
-                    IOUtils.closeQuietly(bsos);
                 }
             } else {
                 logger.error("no request dispatcher: unable to include {}/'{}'", resource, path);

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.