This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.0.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 501eaa8c4c74045aa9563feef466f09968c5f616 Author: Oliver Lietz <[email protected]> AuthorDate: Tue Jul 21 14:28:23 2015 +0000 SLING-4884 remove embedded CaptureResponseWrapper git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/thymeleaf@1692129 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 2 +- .../core/servlet/CaptureResponseWrapper.java | 116 --------------------- 2 files changed, 1 insertion(+), 117 deletions(-) diff --git a/pom.xml b/pom.xml index 44d95d9..e4a03c0 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.scripting.core</artifactId> - <version>2.0.28</version> + <version>2.0.30</version> <scope>provided</scope> </dependency> <dependency> diff --git a/src/main/java/org/apache/sling/scripting/core/servlet/CaptureResponseWrapper.java b/src/main/java/org/apache/sling/scripting/core/servlet/CaptureResponseWrapper.java deleted file mode 100644 index fbc31dd..0000000 --- a/src/main/java/org/apache/sling/scripting/core/servlet/CaptureResponseWrapper.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sling.scripting.core.servlet; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; - -/** - * Extends the HttpServletResponse to wrap the response and capture the results. - */ -public final class CaptureResponseWrapper extends HttpServletResponseWrapper { - - private boolean isBinaryResponse = false; - - private PrintWriter writer; - - private StringWriter stringWriter; - - /** - * Construct a new CaptureResponseWrapper. - * - * @param response the response to wrap - */ - public CaptureResponseWrapper(HttpServletResponse response) { - super(response); - } - - /** - * Returns true if the response is binary. - * - * @return true if the response is binary, false otherwise - */ - public boolean isBinaryResponse() { - return isBinaryResponse; - } - - /* - * (non-Javadoc) - * @see javax.servlet.ServletResponseWrapper#flushBuffer() - */ - @Override - public void flushBuffer() throws IOException { - if (isBinaryResponse()) { - getResponse().getOutputStream().flush(); - } else { - writer.flush(); - } - } - - /* - * (non-Javadoc) - * @see javax.servlet.ServletResponseWrapper#getOutputStream() - * - * @return the output stream from the response - */ - @Override - public ServletOutputStream getOutputStream() throws IOException { - if (writer != null) { - throw new IOException("'getWriter()' has already been invoked for a character data response."); - } - isBinaryResponse = true; - return getResponse().getOutputStream(); - } - - /* - * (non-Javadoc) - * @see javax.servlet.ServletResponseWrapper#getWriter() - * - * @return the writer - */ - @Override - public PrintWriter getWriter() throws IOException { - if (writer != null) { - return writer; - } - if (isBinaryResponse) { - throw new IOException("'getOutputStream()' has already been invoked for a binary data response."); - } - stringWriter = new StringWriter(); - writer = new PrintWriter(stringWriter); - return writer; - } - - /** - * - * @return the captured character response data - * @throws IOException if no character response data captured - */ - public String getCapturedCharacterResponse() throws IOException { - if (stringWriter == null) { - throw new IOException("no character response data captured"); - } - writer.flush(); - return stringWriter.toString(); - } - -} -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
