Author: jboynes Date: Mon Mar 2 14:50:34 2015 New Revision: 1663321 URL: http://svn.apache.org/r1663321 Log: Revert change the attempted to fix https://bz.apache.org/bugzilla/show_bug.cgi?id=37466 The Servlet container should return content for a HEAD request and so there is no need to coerce the HTTP method to GET to try an fool it into doing so.
Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java Modified: tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java URL: http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java?rev=1663321&r1=1663320&r2=1663321&view=diff ============================================================================== --- tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java (original) +++ tomcat/taglibs/standard/trunk/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java Mon Mar 2 14:50:34 2015 @@ -37,7 +37,6 @@ import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import javax.servlet.jsp.JspException; @@ -285,24 +284,21 @@ public abstract class ImportSupport exte } // from this context, get a dispatcher - RequestDispatcher rd = - c.getRequestDispatcher(stripSession(targetUrl)); + RequestDispatcher rd = c.getRequestDispatcher(stripSession(targetUrl)); if (rd == null) { throw new JspTagException(stripSession(targetUrl)); } - // include the resource, using our custom wrapper + // Wrap the response so we capture the capture the output. + // This relies on the underlying container to return content even if this is a HEAD + // request. Some containers (e.g. Tomcat versions without the fix for + // https://bz.apache.org/bugzilla/show_bug.cgi?id=57601 ) may not do that. ImportResponseWrapper irw = - new ImportResponseWrapper( - (HttpServletResponse) pageContext.getResponse()); + new ImportResponseWrapper((HttpServletResponse) pageContext.getResponse()); - ImportRequestWrapper wrappedRequest = - new ImportRequestWrapper( - (HttpServletRequest) pageContext.getRequest()); - - // spec mandates specific error handling form include() + // spec mandates specific error handling from include() try { - rd.include(wrappedRequest, irw); + rd.include(pageContext.getRequest(), irw); } catch (IOException ex) { throw new JspException(ex); } catch (RuntimeException ex) { @@ -387,22 +383,6 @@ public abstract class ImportSupport exte } /** - * Wraps requests to allow us to enforce the method to be GET - */ - private class ImportRequestWrapper extends HttpServletRequestWrapper { - - public ImportRequestWrapper(HttpServletRequest request) { - super(request); - } - - @Override - public String getMethod() { - return "GET"; - } - - } - - /** * Wraps responses to allow us to retrieve results as Strings. */ private class ImportResponseWrapper extends HttpServletResponseWrapper { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org