This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.hc.webconsole-1.1.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-webconsole.git
commit ceb51211be130ab429437bcb7ee4821f80e91c41 Author: Carsten Ziegeler <[email protected]> AuthorDate: Fri Jan 3 06:23:20 2014 +0000 SLING-3278 : Provide a HealthCheckExecutor service. Clean up web console plugin code git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/webconsole@1555017 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/HealthCheckWebconsolePlugin.java | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java b/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java index a541ab1..68be3b9 100644 --- a/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java +++ b/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java @@ -19,6 +19,7 @@ package org.apache.sling.hc.webconsole.impl; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.io.PrintWriter; import java.util.Collection; @@ -83,18 +84,27 @@ public class HealthCheckWebconsolePlugin extends HttpServlet { private boolean getStaticResource(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { final String pathInfo = req.getPathInfo(); - if(pathInfo!= null && pathInfo.contains("res/ui")) { + if (pathInfo!= null && pathInfo.contains("res/ui")) { final String prefix = "/" + LABEL; final InputStream is = getClass().getResourceAsStream(pathInfo.substring(prefix.length())); - if(is == null) { + if (is == null) { resp.sendError(HttpServletResponse.SC_NOT_FOUND, pathInfo); + } else { + final OutputStream os = resp.getOutputStream(); + try { + final byte [] buffer = new byte[16384]; + int n=0; + while( (n = is.read(buffer, 0, buffer.length)) > 0) { + os.write(buffer, 0, n); + } + } finally { + try { + is.close(); + } catch ( final IOException ignore ) { + // ignore + } + } } - final byte [] buffer = new byte[16384]; - int n=0; - while( (n = is.read(buffer, 0, buffer.length)) > 0) { - resp.getOutputStream().write(buffer, 0, n); - } - resp.getOutputStream().flush(); return true; } return false; -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
