Merge pull request #23898 from arjantijms/requestid

diff --git a/appserver/security/webintegration/src/main/java/com/sun/web/security/HttpRequestWrapper.java b/appserver/security/webintegration/src/main/java/com/sun/web/security/HttpRequestWrapper.java
index 7bd7173..d917662 100644
--- a/appserver/security/webintegration/src/main/java/com/sun/web/security/HttpRequestWrapper.java
+++ b/appserver/security/webintegration/src/main/java/com/sun/web/security/HttpRequestWrapper.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation.
  * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -610,20 +611,17 @@
 
     @Override
     public String getRequestId() {
-        // TODO Implement!
-        return null;
+        return servletRequest.getRequestId();
     }
 
     @Override
     public String getProtocolRequestId() {
-        // TODO Implement!
-        return null;
+        return servletRequest.getProtocolRequestId();
     }
 
     @Override
     public ServletConnection getServletConnection() {
-        // TODO Implement!
-        return null;
+        return servletRequest.getServletConnection();
     }
 
 }
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 0bf9345..e7fe1d5 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
@@ -126,6 +126,7 @@
 import org.glassfish.grizzly.Buffer;
 import org.glassfish.grizzly.CompletionHandler;
 import org.glassfish.grizzly.EmptyCompletionHandler;
+import org.glassfish.grizzly.http.Protocol;
 import org.glassfish.grizzly.http.server.Response.SuspendedContextImpl;
 import org.glassfish.grizzly.http.server.TimeoutHandler;
 import org.glassfish.grizzly.http.server.util.MappingData;
@@ -3825,20 +3826,67 @@
 
     @Override
     public String getRequestId() {
-        // TODO Implement!
-        return null;
+        return grizzlyRequest.getRequestId();
     }
 
     @Override
     public String getProtocolRequestId() {
-        // TODO Implement!
-        return null;
+        return grizzlyRequest.getProtocolRequestId();
     }
 
     @Override
     public ServletConnection getServletConnection() {
-        // TODO Implement!
-        return null;
+        String connectionId = grizzlyRequest.getConnection() == null ? null : Long.toString(grizzlyRequest.getConnection().getId());
+        return new ServletConnectionImpl(connectionId, grizzlyRequest.getProtocol(), grizzlyRequest.isSecure());
+    }
+
+    /**
+     * Trivial implementation of the {@link ServletConnection}
+     *
+     * @author David Matejcek
+     */
+    public static class ServletConnectionImpl implements ServletConnection {
+
+        private final String connectionId;
+        private final Protocol protocol;
+        private final boolean secure;
+
+        /**
+         * Just sets all fields.
+         *
+         * @param connectionId - see {@link #getConnectionId()}, can be null.
+         * @param protocol - see {@link #getProtocol()} and {@link Protocol}, can be null.
+         * @param secure - true if the connection was encrypted.
+         */
+        public ServletConnectionImpl(String connectionId, Protocol protocol, boolean secure) {
+            this.connectionId = connectionId;
+            this.protocol = protocol;
+            this.secure = secure;
+        }
+
+        @Override
+        public String getConnectionId() {
+            return this.connectionId;
+        }
+
+
+        @Override
+        public String getProtocol() {
+            return protocol == null ? "unknown" : this.protocol.getProtocolString();
+        }
+
+
+        @Override
+        public String getProtocolConnectionId() {
+            // we don't support HTTP3 yet.
+            return "";
+        }
+
+
+        @Override
+        public boolean isSecure() {
+            return this.secure;
+        }
     }
 
 }
diff --git a/appserver/web/web-core/src/main/java/org/apache/catalina/connector/RequestFacade.java b/appserver/web/web-core/src/main/java/org/apache/catalina/connector/RequestFacade.java
index 11533ba..dbdb412 100644
--- a/appserver/web/web-core/src/main/java/org/apache/catalina/connector/RequestFacade.java
+++ b/appserver/web/web-core/src/main/java/org/apache/catalina/connector/RequestFacade.java
@@ -18,6 +18,9 @@
 
 package org.apache.catalina.connector;
 
+import static org.apache.catalina.Globals.IS_SECURITY_ENABLED;
+import static org.apache.catalina.security.SecurityUtil.isPackageProtectionEnabled;
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.security.AccessControlException;
@@ -31,10 +34,8 @@
 import java.util.Map;
 import java.util.ResourceBundle;
 
-import org.apache.catalina.Globals;
 import org.apache.catalina.LogFacade;
 import org.apache.catalina.core.RequestFacadeHelper;
-import org.apache.catalina.security.SecurityUtil;
 
 import com.sun.enterprise.security.web.integration.WebPrincipal;
 
@@ -56,435 +57,200 @@
 import jakarta.servlet.http.Part;
 import jakarta.servlet.http.PushBuilder;
 
-
 /**
- * Facade class that wraps a Coyote request object.
- * All methods are delegated to the wrapped request.
+ * Facade class that wraps a Catalina connector request object. All methods are delegated to the wrapped request.
  *
  * @author Craig R. McClanahan
  * @author Remy Maucherat
  * @author Jean-Francois Arcand
  * @version $Revision: 1.7 $ $Date: 2007/08/01 19:04:28 $
  */
-public class RequestFacade
-    implements HttpServletRequest {
+public class RequestFacade implements HttpServletRequest {
 
+    // ----------------------------------------------- Class/Instance Variables
+
+    private static final SecurityPermission GET_UNWRAPPED_COYOTE_REQUEST_PERMISSION = new SecurityPermission("getUnwrappedCoyoteRequest");
     private static final ResourceBundle rb = LogFacade.getLogger().getResourceBundle();
 
+    /**
+     * The wrapped request.
+     */
+    protected Request catalinaConnectorReqest;
 
-    // ----------------------------------------------------------- DoPrivileged
+    /*
+     * True if the fact that a request received at the root context was mapped to a default-web-module will be masked, false
+     * otherwise.
+     *
+     * For example, if set to true, this request facade's getContextPath() method will return "/", rather than the context
+     * root of the default-web-module, for requests received at the root context that were mapped to a default-web-module.
+     */
+    private boolean maskDefaultContextMapping;
 
-    private final class GetAttributePrivilegedAction
-            implements PrivilegedAction<Enumeration<String>> {
-
-        @Override
-        public Enumeration<String> run() {
-            return request.getAttributeNames();
-        }
-    }
-
-
-    private final class GetParameterMapPrivilegedAction
-            implements PrivilegedAction<Map<String, String[]>> {
-
-        @Override
-        public Map<String, String[]> run() {
-            return request.getParameterMap();
-        }
-    }
-
-
-    private final class GetRequestDispatcherPrivilegedAction
-            implements PrivilegedAction<RequestDispatcher> {
-
-        private String path;
-
-        public GetRequestDispatcherPrivilegedAction(String path){
-            this.path = path;
-        }
-
-        @Override
-        public RequestDispatcher run() {
-            return request.getRequestDispatcher(path);
-        }
-    }
-
-
-    private final class GetParameterPrivilegedAction
-            implements PrivilegedAction<String> {
-
-        public String name;
-
-        public GetParameterPrivilegedAction(String name){
-            this.name = name;
-        }
-
-        @Override
-        public String run() {
-            return request.getParameter(name);
-        }
-    }
-
-
-    private final class GetParameterNamesPrivilegedAction
-            implements PrivilegedAction<Enumeration<String>> {
-
-        @Override
-        public Enumeration<String> run() {
-            return request.getParameterNames();
-        }
-    }
-
-
-    private final class GetParameterValuePrivilegedAction
-            implements PrivilegedAction<String[]> {
-
-        public String name;
-
-        public GetParameterValuePrivilegedAction(String name){
-            this.name = name;
-        }
-
-        @Override
-        public String[] run() {
-            return request.getParameterValues(name);
-        }
-    }
-
-
-    private final class GetCookiesPrivilegedAction
-            implements PrivilegedAction<Cookie[]> {
-
-        @Override
-        public Cookie[] run() {
-            return request.getCookies();
-        }
-    }
-
-
-    private final class GetCharacterEncodingPrivilegedAction
-            implements PrivilegedAction<String> {
-
-        @Override
-        public String run() {
-            return request.getCharacterEncoding();
-        }
-    }
-
-
-    private final class GetHeadersPrivilegedAction
-            implements PrivilegedAction<Enumeration<String>> {
-
-        private String name;
-
-        public GetHeadersPrivilegedAction(String name){
-            this.name = name;
-        }
-
-        @Override
-        public Enumeration<String> run() {
-            return request.getHeaders(name);
-        }
-    }
-
-
-    private final class GetHeaderNamesPrivilegedAction
-            implements PrivilegedAction<Enumeration<String>> {
-
-        @Override
-        public Enumeration<String> run() {
-            return request.getHeaderNames();
-        }
-    }
-
-
-    private final class GetLocalePrivilegedAction
-            implements PrivilegedAction<Locale> {
-
-        @Override
-        public Locale run() {
-            return request.getLocale();
-        }
-    }
-
-
-    private final class GetLocalesPrivilegedAction
-            implements PrivilegedAction<Enumeration<Locale>> {
-
-        @Override
-        public Enumeration<Locale> run() {
-            return request.getLocales();
-        }
-    }
-
-    private final class GetSessionPrivilegedAction
-            implements PrivilegedAction<HttpSession> {
-
-        private boolean create;
-
-        public GetSessionPrivilegedAction(boolean create){
-            this.create = create;
-        }
-
-        @Override
-        public HttpSession run() {
-            return request.getSession(create);
-        }
-    }
-
-    private final class ChangeSessionIdPrivilegedAction
-            implements PrivilegedAction<String> {
-
-        @Override
-        public String run() {
-            return request.changeSessionId();
-        }
-    }
+    private RequestFacadeHelper reqFacHelper;
 
 
     // ----------------------------------------------------------- Constructors
 
-
     /**
      * Construct a wrapper for the specified request.
      *
-     * @param request The request to be wrapped
+     * @param connectorRequest The request to be wrapped
      */
-    public RequestFacade(Request request) {
-        this(request, false);
+    public RequestFacade(Request connectorRequest) {
+        this(connectorRequest, false);
     }
 
-
     /**
      * Construct a wrapper for the specified request.
      *
      * @param request The request to be wrapped
-     * @param maskDefaultContextMapping true if the fact that a request
-     * received at the root context was mapped to a default-web-module will
-     * be masked, false otherwise
+     * @param maskDefaultContextMapping true if the fact that a request received at the root context was mapped to a
+     * default-web-module will be masked, false otherwise
      */
-    public RequestFacade(Request request,
-                         boolean maskDefaultContextMapping) {
-        this.request = request;
+    public RequestFacade(Request request, boolean maskDefaultContextMapping) {
+        this.catalinaConnectorReqest = request;
         this.maskDefaultContextMapping = maskDefaultContextMapping;
         this.reqFacHelper = new RequestFacadeHelper(request);
     }
 
 
-    // ----------------------------------------------- Class/Instance Variables
-
-
-    private static final SecurityPermission
-        GET_UNWRAPPED_COYOTE_REQUEST_PERMISSION =
-            new SecurityPermission("getUnwrappedCoyoteRequest");
-
-
-
-
-    /**
-     * The wrapped request.
-     */
-    protected Request request = null;
-
-
-    /*
-     * True if the fact that a request received at the root context was
-     * mapped to a default-web-module will be masked, false otherwise.
-     *
-     * For example, if set to true, this request facade's getContextPath()
-     * method will return "/", rather than the context root of the
-     * default-web-module, for requests received at the root context that
-     * were mapped to a default-web-module.
-     */
-    private boolean maskDefaultContextMapping = false;
-
-    private RequestFacadeHelper reqFacHelper = null;
-
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
-    * Prevent cloning the facade.
-    */
+     * Prevent cloning the facade.
+     */
     @Override
-    protected Object clone()
-        throws CloneNotSupportedException {
+    protected Object clone() throws CloneNotSupportedException {
         throw new CloneNotSupportedException();
     }
 
-
     /**
      * Clear facade.
      */
     public void clear() {
-        request = null;
+        catalinaConnectorReqest = null;
         if (reqFacHelper != null) {
             reqFacHelper.clear();
         }
         reqFacHelper = null;
     }
 
-
     RequestFacadeHelper getRequestFacadeHelper() {
         return reqFacHelper;
     }
 
-
     // ------------------------------------------------- ServletRequest Methods
 
     @Override
     public Object getAttribute(String name) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getAttribute(name);
+        return catalinaConnectorReqest.getAttribute(name);
     }
 
     @Override
     public Enumeration<String> getAttributeNames() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetAttributePrivilegedAction());
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetAttributePrivilegedAction());
-        } else {
-            return request.getAttributeNames();
-        }
+        return catalinaConnectorReqest.getAttributeNames();
     }
 
     @Override
     public String getCharacterEncoding() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetCharacterEncodingPrivilegedAction());
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetCharacterEncodingPrivilegedAction());
-        } else {
-            return request.getCharacterEncoding();
-        }
+        return catalinaConnectorReqest.getCharacterEncoding();
     }
 
     @Override
-    public void setCharacterEncoding(String env)
-            throws java.io.UnsupportedEncodingException {
+    public void setCharacterEncoding(String env) throws java.io.UnsupportedEncodingException {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        request.setCharacterEncoding(env);
+        catalinaConnectorReqest.setCharacterEncoding(env);
     }
 
     @Override
     public int getContentLength() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getContentLength();
+        return catalinaConnectorReqest.getContentLength();
     }
 
     @Override
     public long getContentLengthLong() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getContentLengthLong();
+        return catalinaConnectorReqest.getContentLengthLong();
     }
 
     @Override
     public String getContentType() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getContentType();
+        return catalinaConnectorReqest.getContentType();
     }
 
     @Override
     public ServletInputStream getInputStream() throws IOException {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getInputStream();
+        return catalinaConnectorReqest.getInputStream();
     }
 
     @Override
     public HttpServletMapping getHttpServletMapping() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getHttpServletMapping();
+        return catalinaConnectorReqest.getHttpServletMapping();
     }
 
     @Override
     public String getParameter(String name) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetParameterPrivilegedAction(name));
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetParameterPrivilegedAction(name));
-        } else {
-            return request.getParameter(name);
-        }
+        return catalinaConnectorReqest.getParameter(name);
     }
 
     @Override
     public Enumeration<String> getParameterNames() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetParameterNamesPrivilegedAction());
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetParameterNamesPrivilegedAction());
-        } else {
-            return request.getParameterNames();
-        }
+        return catalinaConnectorReqest.getParameterNames();
     }
 
     @Override
     public String[] getParameterValues(String name) {
-
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
+        checkRequestNull();
 
         String[] ret = null;
 
         /*
-         * Clone the returned array only if there is a security manager
-         * in place, so that performance won't suffer in the non-secure case
+         * Clone the returned array only if there is a security manager in place, so that performance won't suffer in the
+         * non-secure case
          */
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            ret = AccessController.doPrivileged(
-                new GetParameterValuePrivilegedAction(name));
+        if (isPackageProtectionEnabled()) {
+            ret = AccessController.doPrivileged(new GetParameterValuePrivilegedAction(name));
             if (ret != null) {
                 ret = ret.clone();
             }
         } else {
-            ret = request.getParameterValues(name);
+            ret = catalinaConnectorReqest.getParameterValues(name);
         }
 
         return ret;
@@ -492,195 +258,142 @@
 
     @Override
     public Map<String, String[]> getParameterMap() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetParameterMapPrivilegedAction());
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetParameterMapPrivilegedAction());
-        } else {
-            return request.getParameterMap();
-        }
+        return catalinaConnectorReqest.getParameterMap();
     }
 
     @Override
     public String getProtocol() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getProtocol();
+        return catalinaConnectorReqest.getProtocol();
     }
 
     @Override
     public String getScheme() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getScheme();
+        return catalinaConnectorReqest.getScheme();
     }
 
     @Override
     public String getServerName() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getServerName();
+        return catalinaConnectorReqest.getServerName();
     }
 
     @Override
     public int getServerPort() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getServerPort();
+        return catalinaConnectorReqest.getServerPort();
     }
 
     @Override
     public BufferedReader getReader() throws IOException {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getReader();
+        return catalinaConnectorReqest.getReader();
     }
 
     @Override
     public String getRemoteAddr() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getRemoteAddr();
+        return catalinaConnectorReqest.getRemoteAddr();
     }
 
     @Override
     public String getRemoteHost() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getRemoteHost();
+        return catalinaConnectorReqest.getRemoteHost();
     }
 
     @Override
     public void setAttribute(String name, Object o) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        request.setAttribute(name, o);
+        catalinaConnectorReqest.setAttribute(name, o);
     }
 
     @Override
     public void removeAttribute(String name) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        request.removeAttribute(name);
+        catalinaConnectorReqest.removeAttribute(name);
     }
 
     @Override
     public Locale getLocale() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetLocalePrivilegedAction());
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetLocalePrivilegedAction());
-        } else {
-            return request.getLocale();
-        }
+        return catalinaConnectorReqest.getLocale();
     }
 
     @Override
     public Enumeration<Locale> getLocales() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetLocalesPrivilegedAction());
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetLocalesPrivilegedAction());
         } else {
-            return request.getLocales();
+            return catalinaConnectorReqest.getLocales();
         }
     }
 
     @Override
     public boolean isSecure() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.isSecure();
+        return catalinaConnectorReqest.isSecure();
     }
 
     @Override
     public RequestDispatcher getRequestDispatcher(String path) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetRequestDispatcherPrivilegedAction(path));
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetRequestDispatcherPrivilegedAction(path));
-        } else {
-            return request.getRequestDispatcher(path);
-        }
+        return catalinaConnectorReqest.getRequestDispatcher(path);
     }
 
     @Override
     public String getAuthType() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getAuthType();
+        return catalinaConnectorReqest.getAuthType();
     }
 
     @Override
     public Cookie[] getCookies() {
-
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
+        checkRequestNull();
 
         Cookie[] ret = null;
 
         /*
-         * Clone the returned array only if there is a security manager
-         * in place, so that performance won't suffer in the non-secure case
+         * Clone the returned array only if there is a security manager in place, so that performance won't suffer in the
+         * non-secure case
          */
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            ret = AccessController.doPrivileged(
-                new GetCookiesPrivilegedAction());
+        if (isPackageProtectionEnabled()) {
+            ret = AccessController.doPrivileged(new GetCookiesPrivilegedAction());
             if (ret != null) {
                 ret = ret.clone();
             }
         } else {
-            ret = request.getCookies();
+            ret = catalinaConnectorReqest.getCookies();
         }
 
         return ret;
@@ -688,179 +401,131 @@
 
     @Override
     public long getDateHeader(String name) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getDateHeader(name);
+        return catalinaConnectorReqest.getDateHeader(name);
     }
 
     @Override
     public String getHeader(String name) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getHeader(name);
+        return catalinaConnectorReqest.getHeader(name);
     }
 
     @Override
     public Enumeration<String> getHeaders(String name) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetHeadersPrivilegedAction(name));
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetHeadersPrivilegedAction(name));
-        } else {
-            return request.getHeaders(name);
-        }
+        return catalinaConnectorReqest.getHeaders(name);
     }
 
     @Override
     public Enumeration<String> getHeaderNames() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetHeaderNamesPrivilegedAction());
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(
-                new GetHeaderNamesPrivilegedAction());
-        } else {
-            return request.getHeaderNames();
-        }
+        return catalinaConnectorReqest.getHeaderNames();
     }
 
     @Override
     public int getIntHeader(String name) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getIntHeader(name);
+        return catalinaConnectorReqest.getIntHeader(name);
     }
 
     @Override
     public Map<String, String> getTrailerFields() {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
+        checkRequestNull();
 
-        return request.getTrailerFields();
+        return catalinaConnectorReqest.getTrailerFields();
     }
 
     @Override
     public boolean isTrailerFieldsReady() {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
+        checkRequestNull();
 
-        return request.isTrailerFieldsReady();
+        return catalinaConnectorReqest.isTrailerFieldsReady();
     }
 
     @Override
     public String getMethod() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getMethod();
+        return catalinaConnectorReqest.getMethod();
     }
 
     @Override
     public String getPathInfo() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getPathInfo();
+        return catalinaConnectorReqest.getPathInfo();
     }
 
     @Override
     public String getPathTranslated() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getPathTranslated();
+        return catalinaConnectorReqest.getPathTranslated();
     }
 
-
     /**
-     * Gets the servlet context to which this servlet request was last
-     * dispatched.
+     * Gets the servlet context to which this servlet request was last dispatched.
      *
-     * @return the servlet context to which this servlet request was last
-     * dispatched
+     * @return the servlet context to which this servlet request was last dispatched
      */
     @Override
     public ServletContext getServletContext() {
-        return request.getServletContext();
+        return catalinaConnectorReqest.getServletContext();
     }
 
     @Override
     public String getContextPath() {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.getContextPath(maskDefaultContextMapping);
+        checkRequestNull();
+
+        return catalinaConnectorReqest.getContextPath(maskDefaultContextMapping);
     }
 
-
     public String getContextPath(boolean maskDefaultContextMapping) {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.getContextPath(maskDefaultContextMapping);
+        checkRequestNull();
+
+        return catalinaConnectorReqest.getContextPath(maskDefaultContextMapping);
     }
 
     @Override
     public String getQueryString() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getQueryString();
+        return catalinaConnectorReqest.getQueryString();
     }
 
     @Override
     public String getRemoteUser() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getRemoteUser();
+        return catalinaConnectorReqest.getRemoteUser();
     }
 
     @Override
     public boolean isUserInRole(String role) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.isUserInRole(role);
+        return catalinaConnectorReqest.isUserInRole(role);
     }
 
     @Override
     public Principal getUserPrincipal() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        Principal principal = request.getUserPrincipal();
+        Principal principal = catalinaConnectorReqest.getUserPrincipal();
         if (principal instanceof WebPrincipal) {
             WebPrincipal webPrincipal = (WebPrincipal) principal;
             if (webPrincipal.getCustomPrincipal() != null) {
@@ -873,328 +538,402 @@
 
     // returns the original, unwrapped principal from the underlying request
     public Principal getRequestPrincipal() {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
+        checkRequestNull();
 
-
-        return request.getUserPrincipal();
+        return catalinaConnectorReqest.getUserPrincipal();
     }
 
     @Override
     public String getRequestedSessionId() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getRequestedSessionId();
+        return catalinaConnectorReqest.getRequestedSessionId();
     }
 
     @Override
     public String getRequestURI() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getRequestURI(maskDefaultContextMapping);
+        return catalinaConnectorReqest.getRequestURI(maskDefaultContextMapping);
     }
 
     @Override
     public StringBuffer getRequestURL() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getRequestURL(maskDefaultContextMapping);
+        return catalinaConnectorReqest.getRequestURL(maskDefaultContextMapping);
     }
 
     @Override
     public String getServletPath() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getServletPath();
+        return catalinaConnectorReqest.getServletPath();
     }
 
     @Override
     public HttpSession getSession(boolean create) {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new GetSessionPrivilegedAction(create));
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.
-                doPrivileged(new GetSessionPrivilegedAction(create));
-        } else {
-            return request.getSession(create);
-        }
+        return catalinaConnectorReqest.getSession(create);
     }
 
     @Override
     public HttpSession getSession() {
-
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
+        checkRequestNull();
 
         return getSession(true);
     }
 
     @Override
     public String changeSessionId() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        if (isPackageProtectionEnabled()) {
+            return AccessController.doPrivileged(new ChangeSessionIdPrivilegedAction());
         }
 
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.
-                    doPrivileged(new ChangeSessionIdPrivilegedAction());
-        } else {
-            return request.changeSessionId();
-        }
+        return catalinaConnectorReqest.changeSessionId();
     }
 
     @Override
     public boolean isRequestedSessionIdValid() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.isRequestedSessionIdValid();
+        return catalinaConnectorReqest.isRequestedSessionIdValid();
     }
 
     @Override
     public boolean isRequestedSessionIdFromCookie() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.isRequestedSessionIdFromCookie();
+        return catalinaConnectorReqest.isRequestedSessionIdFromCookie();
     }
 
     @Override
     public boolean isRequestedSessionIdFromURL() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.isRequestedSessionIdFromURL();
+        return catalinaConnectorReqest.isRequestedSessionIdFromURL();
     }
 
     @Override
     public String getLocalAddr() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getLocalAddr();
+        return catalinaConnectorReqest.getLocalAddr();
     }
 
     @Override
     public String getLocalName() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getLocalName();
+        return catalinaConnectorReqest.getLocalName();
     }
 
     @Override
     public int getLocalPort() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getLocalPort();
+        return catalinaConnectorReqest.getLocalPort();
     }
 
     @Override
     public int getRemotePort() {
+        checkRequestNull();
 
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-
-        return request.getRemotePort();
+        return catalinaConnectorReqest.getRemotePort();
     }
 
     @Override
     public DispatcherType getDispatcherType() {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.getDispatcherType();
-    }
+        checkRequestNull();
 
+        return catalinaConnectorReqest.getDispatcherType();
+    }
 
     /**
      * Starts async processing on this request.
      */
     @Override
     public AsyncContext startAsync() throws IllegalStateException {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.startAsync();
-    }
+        checkRequestNull();
 
+        return catalinaConnectorReqest.startAsync();
+    }
 
     /**
      * Starts async processing on this request.
      */
     @Override
-    public AsyncContext startAsync(ServletRequest sreq,
-                                   ServletResponse sresp)
-            throws IllegalStateException {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.startAsync(sreq, sresp);
-    }
+    public AsyncContext startAsync(ServletRequest sreq, ServletResponse sresp) throws IllegalStateException {
+        checkRequestNull();
 
+        return catalinaConnectorReqest.startAsync(sreq, sresp);
+    }
 
     /**
      * Checks whether async processing has started on this request.
      */
     @Override
     public boolean isAsyncStarted() {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.isAsyncStarted();
-    }
+        checkRequestNull();
 
+        return catalinaConnectorReqest.isAsyncStarted();
+    }
 
     /**
      * Checks whether this request supports async.
      */
     @Override
     public boolean isAsyncSupported() {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.isAsyncSupported();
-    }
+        checkRequestNull();
 
+        return catalinaConnectorReqest.isAsyncSupported();
+    }
 
     /**
      * Gets the AsyncContext of this request.
      */
     @Override
     public AsyncContext getAsyncContext() {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.getAsyncContext();
-    }
+        checkRequestNull();
 
+        return catalinaConnectorReqest.getAsyncContext();
+    }
 
     @Override
     public Collection<Part> getParts() throws IOException, ServletException {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.getParts();
-    }
+        checkRequestNull();
 
+        return catalinaConnectorReqest.getParts();
+    }
 
     @Override
     public Part getPart(String name) throws IOException, ServletException {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.getPart(name);
+        checkRequestNull();
+
+        return catalinaConnectorReqest.getPart(name);
     }
 
     @Override
-    public boolean authenticate(HttpServletResponse response)
-            throws IOException, ServletException {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.authenticate(response);
+    public boolean authenticate(HttpServletResponse response) throws IOException, ServletException {
+        checkRequestNull();
+
+        return catalinaConnectorReqest.authenticate(response);
     }
 
     @Override
-    public void login(String username, String password)
-            throws ServletException {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        request.login(username, password);
+    public void login(String username, String password) throws ServletException {
+        checkRequestNull();
+
+        catalinaConnectorReqest.login(username, password);
     }
 
     @Override
     public void logout() throws ServletException {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        request.logout();
+        checkRequestNull();
+
+        catalinaConnectorReqest.logout();
     }
 
     @Override
     public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException {
-        if (request == null) {
-            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
-        }
-        return request.upgrade(handlerClass);
+        checkRequestNull();
+
+        return catalinaConnectorReqest.upgrade(handlerClass);
     }
 
     @Override
     public PushBuilder newPushBuilder() {
-        return request.newPushBuilder();
+        return catalinaConnectorReqest.newPushBuilder();
     }
 
-
-    //START S1AS 4703023
     /**
      * Return the original <code>CoyoteRequest</code> object.
      */
-    public Request getUnwrappedCoyoteRequest()
-        throws AccessControlException {
-
-        // tomcat does not have any Permission types so instead of
+    public Request getUnwrappedCoyoteRequest() throws AccessControlException {
+        // Tomcat does not have any Permission types so instead of
         // creating a TomcatPermission for this, use SecurityPermission.
-        if (Globals.IS_SECURITY_ENABLED) {
-            AccessController.checkPermission(
-                GET_UNWRAPPED_COYOTE_REQUEST_PERMISSION);
+        if (IS_SECURITY_ENABLED) {
+            AccessController.checkPermission(GET_UNWRAPPED_COYOTE_REQUEST_PERMISSION);
         }
 
-        return request;
+        return catalinaConnectorReqest;
     }
-    //END S1AS 4703023
-
 
     @Override
     public String getRequestId() {
-        // TODO Implement!
-        return null;
-    }
+        checkRequestNull();
 
+        return catalinaConnectorReqest.getRequestId();
+    }
 
     @Override
     public String getProtocolRequestId() {
-        // // TODO Implement!
-        return null;
-    }
+        checkRequestNull();
 
+        return catalinaConnectorReqest.getProtocolRequestId();
+    }
 
     @Override
     public ServletConnection getServletConnection() {
-        // // TODO Implement!
-        return null;
+        checkRequestNull();
+
+        return catalinaConnectorReqest.getServletConnection();
+    }
+
+    private void checkRequestNull() {
+        if (catalinaConnectorReqest == null) {
+            throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
+        }
+    }
+
+    // ----------------------------------------------------------- DoPrivileged
+
+    private final class GetAttributePrivilegedAction implements PrivilegedAction<Enumeration<String>> {
+
+        @Override
+        public Enumeration<String> run() {
+            return catalinaConnectorReqest.getAttributeNames();
+        }
+    }
+
+    private final class GetParameterMapPrivilegedAction implements PrivilegedAction<Map<String, String[]>> {
+
+        @Override
+        public Map<String, String[]> run() {
+            return catalinaConnectorReqest.getParameterMap();
+        }
+    }
+
+    private final class GetRequestDispatcherPrivilegedAction implements PrivilegedAction<RequestDispatcher> {
+
+        private String path;
+
+        public GetRequestDispatcherPrivilegedAction(String path) {
+            this.path = path;
+        }
+
+        @Override
+        public RequestDispatcher run() {
+            return catalinaConnectorReqest.getRequestDispatcher(path);
+        }
+    }
+
+    private final class GetParameterPrivilegedAction implements PrivilegedAction<String> {
+
+        public String name;
+
+        public GetParameterPrivilegedAction(String name) {
+            this.name = name;
+        }
+
+        @Override
+        public String run() {
+            return catalinaConnectorReqest.getParameter(name);
+        }
+    }
+
+    private final class GetParameterNamesPrivilegedAction implements PrivilegedAction<Enumeration<String>> {
+
+        @Override
+        public Enumeration<String> run() {
+            return catalinaConnectorReqest.getParameterNames();
+        }
+    }
+
+    private final class GetParameterValuePrivilegedAction implements PrivilegedAction<String[]> {
+
+        public String name;
+
+        public GetParameterValuePrivilegedAction(String name) {
+            this.name = name;
+        }
+
+        @Override
+        public String[] run() {
+            return catalinaConnectorReqest.getParameterValues(name);
+        }
+    }
+
+    private final class GetCookiesPrivilegedAction implements PrivilegedAction<Cookie[]> {
+
+        @Override
+        public Cookie[] run() {
+            return catalinaConnectorReqest.getCookies();
+        }
+    }
+
+    private final class GetCharacterEncodingPrivilegedAction implements PrivilegedAction<String> {
+
+        @Override
+        public String run() {
+            return catalinaConnectorReqest.getCharacterEncoding();
+        }
+    }
+
+    private final class GetHeadersPrivilegedAction implements PrivilegedAction<Enumeration<String>> {
+
+        private String name;
+
+        public GetHeadersPrivilegedAction(String name) {
+            this.name = name;
+        }
+
+        @Override
+        public Enumeration<String> run() {
+            return catalinaConnectorReqest.getHeaders(name);
+        }
+    }
+
+    private final class GetHeaderNamesPrivilegedAction implements PrivilegedAction<Enumeration<String>> {
+
+        @Override
+        public Enumeration<String> run() {
+            return catalinaConnectorReqest.getHeaderNames();
+        }
+    }
+
+    private final class GetLocalePrivilegedAction implements PrivilegedAction<Locale> {
+
+        @Override
+        public Locale run() {
+            return catalinaConnectorReqest.getLocale();
+        }
+    }
+
+    private final class GetLocalesPrivilegedAction implements PrivilegedAction<Enumeration<Locale>> {
+
+        @Override
+        public Enumeration<Locale> run() {
+            return catalinaConnectorReqest.getLocales();
+        }
+    }
+
+    private final class GetSessionPrivilegedAction implements PrivilegedAction<HttpSession> {
+
+        private boolean create;
+
+        public GetSessionPrivilegedAction(boolean create) {
+            this.create = create;
+        }
+
+        @Override
+        public HttpSession run() {
+            return catalinaConnectorReqest.getSession(create);
+        }
+    }
+
+    private final class ChangeSessionIdPrivilegedAction implements PrivilegedAction<String> {
+
+        @Override
+        public String run() {
+            return catalinaConnectorReqest.changeSessionId();
+        }
     }
 }
diff --git a/appserver/web/web-core/src/main/java/org/apache/catalina/core/DummyRequest.java b/appserver/web/web-core/src/main/java/org/apache/catalina/core/DummyRequest.java
index b32c885..a338c4e 100644
--- a/appserver/web/web-core/src/main/java/org/apache/catalina/core/DummyRequest.java
+++ b/appserver/web/web-core/src/main/java/org/apache/catalina/core/DummyRequest.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation.
  * Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved.
  * Copyright 2004 The Apache Software Foundation
  *
@@ -17,7 +18,6 @@
 
 package org.apache.catalina.core;
 
-
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -57,8 +57,7 @@
 import org.glassfish.grizzly.http.util.DataChunk;
 
 /**
- * Dummy request object, used for request dispatcher mapping, as well as
- * JSP precompilation.
+ * Dummy request object, used for request dispatcher mapping, as well as JSP precompilation.
  *
  * @author Remy Maucherat
  * @version $Revision: 1.5.6.2 $ $Date: 2008/04/17 18:37:07 $
@@ -73,25 +72,21 @@
 
     protected FilterChain filterChain;
 
-    // START CR 6415120
     /**
-     * Whether or not access to resources in WEB-INF or META-INF needs to be
-     * checked.
+     * Whether or not access to resources in WEB-INF or META-INF needs to be checked.
      */
     protected boolean checkRestrictedResources = true;
-    // END CR 6415120
 
-    // START PWC 4707989
     private String method;
-    // END PWC 4707989
 
-    private static Enumeration<String> dummyEnum = new Enumeration<String>(){
+    private static Enumeration<String> dummyEnum = new Enumeration<String>() {
         @Override
-        public boolean hasMoreElements(){
+        public boolean hasMoreElements() {
             return false;
         }
+
         @Override
-        public String nextElement(){
+        public String nextElement() {
             return null;
         }
     };
@@ -171,7 +166,6 @@
         this.wrapper = wrapper;
     }
 
-    // START PWC 4707989
     @Override
     public void setMethod(String method) {
         this.method = method;
@@ -181,254 +175,536 @@
     public String getMethod() {
         return method;
     }
-    // END PWC 4707989
 
     @Override
-    public String getAuthorization() { return null; }
+    public String getAuthorization() {
+        return null;
+    }
+
     @Override
-    public Connector getConnector() { return null; }
+    public Connector getConnector() {
+        return null;
+    }
+
     @Override
-    public void setConnector(Connector connector) {}
+    public void setConnector(Connector connector) {
+    }
+
     @Override
-    public Context getContext() { return null; }
+    public Context getContext() {
+        return null;
+    }
+
     @Override
-    public void setContext(Context context) {}
+    public void setContext(Context context) {
+    }
+
     @Override
-    public Host getHost() { return null; }
+    public Host getHost() {
+        return null;
+    }
+
     @Override
-    public void setHost(Host host) {}
+    public void setHost(Host host) {
+    }
+
     @Override
-    public String getInfo() { return null; }
+    public String getInfo() {
+        return null;
+    }
+
     @Override
-    public Response getResponse() { return null; }
+    public Response getResponse() {
+        return null;
+    }
+
     @Override
-    public void setResponse(Response response) {}
+    public void setResponse(Response response) {
+    }
+
     @Override
-    public Socket getSocket() { return null; }
+    public Socket getSocket() {
+        return null;
+    }
+
     @Override
-    public void setSocket(Socket socket) {}
+    public void setSocket(Socket socket) {
+    }
+
     @Override
-    public InputStream getStream() { return null; }
+    public InputStream getStream() {
+        return null;
+    }
+
     @Override
-    public void setStream(InputStream input) {}
+    public void setStream(InputStream input) {
+    }
+
     @Override
-    public void addLocale(Locale locale) {}
+    public void addLocale(Locale locale) {
+    }
+
     @Override
     public ServletInputStream createInputStream() throws IOException {
         return null;
     }
+
     @Override
-    public void finishRequest() throws IOException {}
+    public void finishRequest() throws IOException {
+    }
+
     @Override
-    public Object getNote(String name) { return null; }
+    public Object getNote(String name) {
+        return null;
+    }
+
     @Override
-    public Iterator<String> getNoteNames() { return null; }
+    public Iterator<String> getNoteNames() {
+        return null;
+    }
+
     @Override
-    public void removeNote(String name) {}
+    public void removeNote(String name) {
+    }
+
     @Override
-    public void setContentType(String type) {}
+    public void setContentType(String type) {
+    }
+
     @Override
-    public void setNote(String name, Object value) {}
+    public void setNote(String name, Object value) {
+    }
+
     @Override
-    public void setProtocol(String protocol) {}
+    public void setProtocol(String protocol) {
+    }
+
     @Override
-    public void setRemoteAddr(String remoteAddr) {}
-    public void setRemoteHost(String remoteHost) {}
+    public void setRemoteAddr(String remoteAddr) {
+    }
+
+    public void setRemoteHost(String remoteHost) {
+    }
+
     @Override
-    public void setServerName(String name) {}
+    public void setServerName(String name) {
+    }
+
     @Override
-    public void setServerPort(int port) {}
+    public void setServerPort(int port) {
+    }
+
     @Override
-    public Object getAttribute(String name) { return null; }
+    public Object getAttribute(String name) {
+        return null;
+    }
+
     @Override
-    public Enumeration<String> getAttributeNames() { return null; }
+    public Enumeration<String> getAttributeNames() {
+        return null;
+    }
+
     @Override
-    public String getCharacterEncoding() { return null; }
+    public String getCharacterEncoding() {
+        return null;
+    }
+
     @Override
-    public int getContentLength() { return -1; }
+    public int getContentLength() {
+        return -1;
+    }
+
     @Override
-    public long getContentLengthLong() { return -1L; }
+    public long getContentLengthLong() {
+        return -1L;
+    }
+
     @Override
-    public void setContentLength(int length) {}
+    public void setContentLength(int length) {
+    }
+
     @Override
-    public String getContentType() { return null; }
+    public String getContentType() {
+        return null;
+    }
+
     @Override
     public ServletInputStream getInputStream() throws IOException {
         return null;
     }
+
     @Override
-    public Locale getLocale() { return null; }
+    public Locale getLocale() {
+        return null;
+    }
+
     @Override
-    public Enumeration<Locale> getLocales() { return null; }
+    public Enumeration<Locale> getLocales() {
+        return null;
+    }
+
     @Override
-    public String getProtocol() { return null; }
+    public String getProtocol() {
+        return null;
+    }
+
     @Override
-    public BufferedReader getReader() throws IOException { return null; }
-    public String getRealPath(String path) { return null; }
+    public BufferedReader getReader() throws IOException {
+        return null;
+    }
+
+    public String getRealPath(String path) {
+        return null;
+    }
+
     @Override
-    public String getRemoteAddr() { return null; }
+    public String getRemoteAddr() {
+        return null;
+    }
+
     @Override
-    public String getRemoteHost() { return null; }
+    public String getRemoteHost() {
+        return null;
+    }
+
     @Override
-    public String getScheme() { return null; }
+    public String getScheme() {
+        return null;
+    }
+
     @Override
-    public String getServerName() { return null; }
+    public String getServerName() {
+        return null;
+    }
+
     @Override
-    public int getServerPort() { return -1; }
+    public int getServerPort() {
+        return -1;
+    }
+
     @Override
-    public boolean isSecure() { return false; }
+    public boolean isSecure() {
+        return false;
+    }
+
     @Override
-    public void removeAttribute(String name) {}
+    public void removeAttribute(String name) {
+    }
+
     @Override
-    public void setAttribute(String name, Object value) {}
+    public void setAttribute(String name, Object value) {
+    }
+
     @Override
-    public void setCharacterEncoding(String enc)
-        throws UnsupportedEncodingException {}
+    public void setCharacterEncoding(String enc) throws UnsupportedEncodingException {
+    }
+
     @Override
-    public void addCookie(Cookie cookie) {}
+    public void addCookie(Cookie cookie) {
+    }
+
     @Override
-    public void addHeader(String name, String value) {}
+    public void addHeader(String name, String value) {
+    }
+
     @Override
-    public void addParameter(String name, String values[]) {}
+    public void addParameter(String name, String values[]) {
+    }
+
     @Override
-    public void clearCookies() {}
+    public void clearCookies() {
+    }
+
     @Override
-    public void clearHeaders() {}
+    public void clearHeaders() {
+    }
+
     @Override
-    public void clearLocales() {}
+    public void clearLocales() {
+    }
+
     @Override
-    public void clearParameters() {}
+    public void clearParameters() {
+    }
+
     @Override
-    public void replayPayload(byte[] payloadByteArray) {}
+    public void replayPayload(byte[] payloadByteArray) {
+    }
+
     @Override
-    public void recycle() {}
+    public void recycle() {
+    }
+
     @Override
-    public void setAuthType(String authType) {}
-    /* START PWC 4707989
-    public void setMethod(String method) {}
-    */
+    public void setAuthType(String authType) {
+    }
+
     @Override
-    public void setRequestedSessionCookie(boolean flag) {}
+    public void setRequestedSessionCookie(boolean flag) {
+    }
+
     @Override
-    public void setRequestedSessionId(String id) {}
+    public void setRequestedSessionId(String id) {
+    }
+
     @Override
-    public void setRequestedSessionURL(boolean flag) {}
+    public void setRequestedSessionURL(boolean flag) {
+    }
+
     @Override
-    public void setRequestURI(String uri) {}
+    public void setRequestURI(String uri) {
+    }
+
     @Override
-    public void setSecure(boolean secure) {}
+    public void setSecure(boolean secure) {
+    }
+
     @Override
-    public void setUserPrincipal(Principal principal) {}
+    public void setUserPrincipal(Principal principal) {
+    }
+
     @Override
-    public String getParameter(String name) { return null; }
+    public String getParameter(String name) {
+        return null;
+    }
+
     @Override
-    public Map<String, String[]> getParameterMap() { return null; }
+    public Map<String, String[]> getParameterMap() {
+        return null;
+    }
+
     @Override
-    public Enumeration<String> getParameterNames() { return dummyEnum; }
+    public Enumeration<String> getParameterNames() {
+        return dummyEnum;
+    }
+
     @Override
-    public String[] getParameterValues(String name) { return null; }
+    public String[] getParameterValues(String name) {
+        return null;
+    }
+
     @Override
     public RequestDispatcher getRequestDispatcher(String path) {
         return null;
     }
-    @Override
-    public String getAuthType() { return null; }
-    @Override
-    public Cookie[] getCookies() { return null; }
-    @Override
-    public long getDateHeader(String name) { return -1; }
-    @Override
-    public String getHeader(String name) { return null; }
-    @Override
-    public Enumeration<String> getHeaders(String name) { return null; }
-    @Override
-    public Enumeration<String> getHeaderNames() { return null; }
-    @Override
-    public int getIntHeader(String name) { return -1; }
-    /* START PWC 4707989
-    public String getMethod() { return null; }
-    */
-    @Override
-    public String getPathTranslated() { return null; }
-    @Override
-    public String getRemoteUser() { return null; }
-    @Override
-    public String getRequestedSessionId() { return null; }
-    @Override
-    public String getRequestURI() { return null; }
-    @Override
-    public StringBuffer getRequestURL() { return null; }
-    @Override
-    public HttpSession getSession() { return null; }
-    @Override
-    public HttpSession getSession(boolean create) { return null; }
-    @Override
-    public Session getSessionInternal(boolean create) { return null; }
-    @Override
-    public String changeSessionId() { return null; }
-    @Override
-    public boolean isRequestedSessionIdFromCookie() { return false; }
-    @Override
-    public boolean isRequestedSessionIdFromURL() { return false; }
-    public boolean isRequestedSessionIdFromUrl() { return false; }
-    @Override
-    public boolean isRequestedSessionIdValid() { return false; }
-    @Override
-    public void setRequestedSessionCookiePath(String cookiePath) {}
-    @Override
-    public boolean isUserInRole(String role) { return false; }
-    @Override
-    public Principal getUserPrincipal() { return null; }
-    @Override
-    public String getLocalAddr() { return null; }
-    @Override
-    public String getLocalName() { return null; }
-    @Override
-    public int getLocalPort() { return -1; }
-    @Override
-    public int getRemotePort() { return -1; }
-    @Override
-    public DispatcherType getDispatcherType() { return null; }
-    @Override
-    public AsyncContext startAsync() throws IllegalStateException { return null; }
-    @Override
-    public AsyncContext startAsync(ServletRequest servletRequest,
-                                   ServletResponse servletResponse)
-            throws IllegalStateException { return null; }
-    @Override
-    public boolean isAsyncStarted() { return false; }
-    @Override
-    public boolean isAsyncSupported() { return false; }
-    public void setAsyncTimeout(long timeout) {}
-    public long getAsyncTimeout() { return -1; }
-    @Override
-    public AsyncContext getAsyncContext() { return null; }
-    public void addAsyncListener(AsyncListener listener) {};
-    public void addAsyncListener(AsyncListener listener,
-                                 ServletRequest servletRequest,
-                                 ServletResponse servletResponse) {}
-    public boolean isSetAsyncTimeoutCalled() { return false; }
-    @Override
-    public void disableAsyncSupport() {}
-    @Override
-    public Collection<Part> getParts() {return null;}
-    @Override
-    public Part getPart(String name) {return null;}
-    @Override
-    public boolean authenticate(HttpServletResponse response)
-        throws IOException, ServletException { return false; }
-    @Override
-    public void login(String username, String password)
-        throws ServletException {}
-    @Override
-    public void logout() throws ServletException {}
-    @Override
-    public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) { return null; }
 
-    // START CR 6415120
+    @Override
+    public String getAuthType() {
+        return null;
+    }
+
+    @Override
+    public Cookie[] getCookies() {
+        return null;
+    }
+
+    @Override
+    public long getDateHeader(String name) {
+        return -1;
+    }
+
+    @Override
+    public String getHeader(String name) {
+        return null;
+    }
+
+    @Override
+    public Enumeration<String> getHeaders(String name) {
+        return null;
+    }
+
+    @Override
+    public Enumeration<String> getHeaderNames() {
+        return null;
+    }
+
+    @Override
+    public int getIntHeader(String name) {
+        return -1;
+    }
+
+    /*
+     * START PWC 4707989 public String getMethod() { return null; }
+     */
+    @Override
+    public String getPathTranslated() {
+        return null;
+    }
+
+    @Override
+    public String getRemoteUser() {
+        return null;
+    }
+
+    @Override
+    public String getRequestedSessionId() {
+        return null;
+    }
+
+    @Override
+    public String getRequestURI() {
+        return null;
+    }
+
+    @Override
+    public StringBuffer getRequestURL() {
+        return null;
+    }
+
+    @Override
+    public HttpSession getSession() {
+        return null;
+    }
+
+    @Override
+    public HttpSession getSession(boolean create) {
+        return null;
+    }
+
+    @Override
+    public Session getSessionInternal(boolean create) {
+        return null;
+    }
+
+    @Override
+    public String changeSessionId() {
+        return null;
+    }
+
+    @Override
+    public boolean isRequestedSessionIdFromCookie() {
+        return false;
+    }
+
+    @Override
+    public boolean isRequestedSessionIdFromURL() {
+        return false;
+    }
+
+    public boolean isRequestedSessionIdFromUrl() {
+        return false;
+    }
+
+    @Override
+    public boolean isRequestedSessionIdValid() {
+        return false;
+    }
+
+    @Override
+    public void setRequestedSessionCookiePath(String cookiePath) {
+    }
+
+    @Override
+    public boolean isUserInRole(String role) {
+        return false;
+    }
+
+    @Override
+    public Principal getUserPrincipal() {
+        return null;
+    }
+
+    @Override
+    public String getLocalAddr() {
+        return null;
+    }
+
+    @Override
+    public String getLocalName() {
+        return null;
+    }
+
+    @Override
+    public int getLocalPort() {
+        return -1;
+    }
+
+    @Override
+    public int getRemotePort() {
+        return -1;
+    }
+
+    @Override
+    public DispatcherType getDispatcherType() {
+        return null;
+    }
+
+    @Override
+    public AsyncContext startAsync() throws IllegalStateException {
+        return null;
+    }
+
+    @Override
+    public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException {
+        return null;
+    }
+
+    @Override
+    public boolean isAsyncStarted() {
+        return false;
+    }
+
+    @Override
+    public boolean isAsyncSupported() {
+        return false;
+    }
+
+    public void setAsyncTimeout(long timeout) {
+    }
+
+    public long getAsyncTimeout() {
+        return -1;
+    }
+
+    @Override
+    public AsyncContext getAsyncContext() {
+        return null;
+    }
+
+    public void addAsyncListener(AsyncListener listener) {
+    };
+
+    public void addAsyncListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) {
+    }
+
+    public boolean isSetAsyncTimeoutCalled() {
+        return false;
+    }
+
+    @Override
+    public void disableAsyncSupport() {
+    }
+
+    @Override
+    public Collection<Part> getParts() {
+        return null;
+    }
+
+    @Override
+    public Part getPart(String name) {
+        return null;
+    }
+
+    @Override
+    public boolean authenticate(HttpServletResponse response) throws IOException, ServletException {
+        return false;
+    }
+
+    @Override
+    public void login(String username, String password) throws ServletException {
+    }
+
+    @Override
+    public void logout() throws ServletException {
+    }
+
+    @Override
+    public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) {
+        return null;
+    }
+
     /**
-     * Set whether or not access to resources under WEB-INF or META-INF
-     * needs to be checked.
+     * Set whether or not access to resources under WEB-INF or META-INF needs to be checked.
      */
     @Override
     public void setCheckRestrictedResources(boolean check) {
@@ -436,33 +712,27 @@
     }
 
     /**
-     * Return whether or not access to resources under WEB-INF or META-INF
-     * needs to be checked.
+     * Return whether or not access to resources under WEB-INF or META-INF needs to be checked.
      */
     @Override
     public boolean getCheckRestrictedResources() {
         return checkRestrictedResources;
     }
-    // END CR 6415120
 
-    // START SJSAS 6346226
     /**
-     * Gets the jroute id of this request, which may have been
-     * sent as a separate <code>JROUTE</code> cookie or appended to the
-     * session identifier encoded in the URI (if cookies have been disabled).
+     * Gets the jroute id of this request, which may have been sent as a separate <code>JROUTE</code> cookie or appended to
+     * the session identifier encoded in the URI (if cookies have been disabled).
      *
-     * @return The jroute id of this request, or null if this request does not
-     * carry any jroute id
+     * @return The jroute id of this request, or null if this request does not carry any jroute id
      */
     @Override
     public String getJrouteId() {
         return null;
     }
-    // END SJSAS 6346226
 
     /**
-     * This object does not implement a session ID generator. Provide
-     * a dummy implementation so that the default one will be used.
+     * This object does not implement a session ID generator. Provide a dummy implementation so that the default one will be
+     * used.
      */
     @Override
     public String generateSessionId() {
@@ -470,11 +740,9 @@
     }
 
     /**
-     * Gets the servlet context to which this servlet request was last
-     * dispatched.
+     * Gets the servlet context to which this servlet request was last dispatched.
      *
-     * @return the servlet context to which this servlet request was last
-     * dispatched
+     * @return the servlet context to which this servlet request was last dispatched
      */
     @Override
     public ServletContext getServletContext() {
@@ -487,25 +755,22 @@
     }
 
     @Override
-    public void unlockSession() {}
+    public void unlockSession() {
+    }
 
     @Override
     public String getRequestId() {
-        // TODO IMPLEMENT!
         return null;
     }
 
     @Override
     public String getProtocolRequestId() {
-        // TODO IMPLEMENT!
         return null;
     }
 
     @Override
     public ServletConnection getServletConnection() {
-        // TODO IMPLEMENT!
         return null;
     }
 
 }
-