From b9555331c62fd225dbf5a13ef5fa422ea03027a7 Mon Sep 17 00:00:00 2001 From: swchan2 Date: Wed, 2 May 2012 19:17:19 +0000 Subject: [PATCH] fix issue http://java.net/jira/browse/GLASSFISH-18680 ("[devtest] request-dispatcher-forward-send-error-commit-response failure") git-svn-id: https://svn.java.net/svn/glassfish~svn/trunk/main@53779 6f3ba3e3-413c-0410-a8aa-90bee3ab43b5 --- .../java/org/apache/catalina/connector/Request.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/appserver/web/web-core/src/main/java/org/apache/catalina/connector/Request.java b/appserver/web/web-core/src/main/java/org/apache/catalina/connector/Request.java index c2dd8cb46e0..32a3601fb7f 100644 --- a/appserver/web/web-core/src/main/java/org/apache/catalina/connector/Request.java +++ b/appserver/web/web-core/src/main/java/org/apache/catalina/connector/Request.java @@ -504,6 +504,8 @@ protected synchronized Object initialValue() { private String servletPath; private String pathInfo; + private boolean initRequestFacadeHelper = false; + // Allow Grizzly to auto detect a remote close connection. public final static boolean discardDisconnectEvent = Boolean.getBoolean("org.glassfish.grizzly.discardDisconnect"); @@ -616,6 +618,7 @@ public void recycle() { mappingData.recycle(); + initRequestFacadeHelper = false; if (enforceScope) { if (facade != null) { facade.clear(); @@ -836,16 +839,25 @@ public HttpServletRequest getRequest(boolean maskDefaultContextMapping) { if (!maskDefaultContextMapping || !isDefaultContext) { if (facade == null) { facade = new RequestFacade(this); + } + + if (!initRequestFacadeHelper) { attributes.put(Globals.REQUEST_FACADE_HELPER, facade.getRequestFacadeHelper()); + initRequestFacadeHelper = true; } return facade; } else { if (defaultContextMaskingFacade == null) { defaultContextMaskingFacade = new RequestFacade(this, true); + } + + if (!initRequestFacadeHelper) { attributes.put(Globals.REQUEST_FACADE_HELPER, defaultContextMaskingFacade.getRequestFacadeHelper()); + initRequestFacadeHelper = true; } + return defaultContextMaskingFacade; } }