If the given request is a MultipartRequestWrapper (Struts class that doesn't extend
HttpServletRequestWrapper), return the wrapped request; otherwise, return the given request.
@exclude
192540
public static HttpServletRequest unwrapMultipart( HttpServletRequest request )
    {
        if ( request instanceof MultipartRequestWrapper )
        {
            request = ( ( MultipartRequestWrapper ) request ).getRequest();
        }
        
        return request;
    }
213949
public static ServletHttpResponse unwrap(ServletResponse response)
    {
        while (!(response instanceof ServletHttpResponse))
        {
            if (response instanceof ServletResponseWrapper)
            {
                ServletResponseWrapper wrapper =
                    (ServletResponseWrapper)response;
                response=wrapper.getResponse();
            }
            else
                throw new IllegalArgumentException("Does not wrap ServletHttpResponse");
        }

        return (ServletHttpResponse)response;
    }
1369999
@Override
    public <T> T unwrap(Class<T> clazz) {
        return HttpServletRequest.class.isAssignableFrom(clazz) ?
            clazz.cast(request) :
            HttpServletResponse.class.isAssignableFrom(clazz) ?
                clazz.cast(response) :
                null;
    }
74773
@Override
    public boolean isWrapperFor(ServletRequest wrapped) {
        final ServletRequest request = getHttpServletRequest();

        if (request == wrapped) {
            return true;
        } else if (request instanceof ServletRequestWrapper) {
            return ((ServletRequestWrapper) request).isWrapperFor(wrapped);
        } else {
            return false;
        }
    }
616047
private JwtRequest getJwtRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
		JwtRequest jwtRequest = (JwtRequest) request.getAttribute(WebConstants.JWT_REQUEST_ATTR);
		if (jwtRequest == null) {
			String errorMsg = Tr.formatMessage(tc, "JWT_REQUEST_ATTRIBUTE_MISSING",
					new Object[] { request.getRequestURI(), WebConstants.JWT_REQUEST_ATTR });
			Tr.error(tc, errorMsg);
			response.sendError(HttpServletResponse.SC_NOT_FOUND, errorMsg);
		}
		return jwtRequest;
	}
616835
@Override
	public StringBuffer getClientSideHandlerScript(HttpServletRequest request) {

		StringBuffer sb = getHeaderSection(request);

		boolean useGzip = RendererRequestUtils.isRequestGzippable(request, this.config);

		Map<String, String> variants = this.config.getGeneratorRegistry().resolveVariants(request);
		sb.append("JAWR.loader.mapping='").append(getPathPrefix(request, this.config)).append("';\n");

		// Start an self executing function
		sb.append("(function(){\n");

		// shorthand for creating ResourceBundles. makes the script shorter.
		sb.append("function r(n, p, i,ie,aU){return new JAWR.ResourceBundle(n, p, i,ie,aU);}\n");

		sb.append("JAWR.loader.jsbundles = [");
		sb.append(getClientSideBundles(variants, useGzip));
		sb.append("]\n");

		// Retrieve the resourcehandler for CSS if there is one.
		ResourceBundlesHandler rsHandler = (ResourceBundlesHandler) request.getSession().getServletContext()
				.getAttribute(JawrConstant.CSS_CONTEXT_ATTRIBUTE);
		boolean isCSSHandler = false;
		if (null != rsHandler) {
			ClientSideHandlerGenerator generator = rsHandler.getClientSideHandler();
			// If this is not a pointer to the same generator it means this
			// generator is the javascript one,
			// so we add CSS bundles to the script
			if (this != generator) {
				variants = rsHandler.getConfig().getGeneratorRegistry().resolveVariants(request);
				sb.append(";JAWR.loader.cssbundles = [");
				sb.append(generator.getClientSideBundles(variants, useGzip));
				sb.append("];\n");
			} else
				isCSSHandler = true;

			// Add the mapping for css resources
			sb.append("JAWR.loader.cssmapping='").append(getPathPrefix(request, rsHandler.getConfig())).append("';\n");
		}
		// End self executing function
		sb.append("})();");

		// Appends extra functions for debug mode
		if (this.config.isDebugModeOn()) {
			sb.append(debugScriptTemplate.toString()).append("\n");
		}

		// The global bundles are already sorted and filtered by the
		// bundleshandler
		for (JoinableResourceBundle bundle : globalBundles) {
			String func = isCSSHandler ? "JAWR.loader.style(" : "JAWR.loader.script(";
			sb.append(func).append(JavascriptStringUtil.quote(bundle.getId())).append(");\n");
		}

		// Minify the result
		if (!this.config.isDebugModeOn()) {
			JSMinPostProcessor p = new JSMinPostProcessor();
			try {
				sb = p.minifyStringBuffer(sb, config.getResourceCharset());
			} catch (IOException | JSMin.JSMinException e) {
				throw new BundlingProcessException("Unexpected error creating client side resource handler", e);
			}
		}
		return sb;
	}
422615
@SuppressWarnings("null")
  private boolean accepts(SlingHttpServletRequest request) {
    return request.getMethod().equalsIgnoreCase(METHOD_GET)
        && request.getResource() != null
        && StringUtils.equals(request.getResource().getValueMap().get(JCR_PRIMARYTYPE, String.class), NT_FILE);
  }
169661
public static <X, P extends MessageQueryParameter<X>, R extends RequestBody, M extends MessageParameters> X getQueryParameter(
			final HandlerRequest<R, M> request,
			final Class<P> queryParameterClass) throws RestHandlerException {

		return getQueryParameter(request, queryParameterClass, null);
	}
641529
private HttpServletRequest wrapTheRequest(final ServletRequest request, final AuthPrincipal principal) {
        HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper((HttpServletRequest) request) {
            @Override
            public Principal getUserPrincipal() {
                return principal;
            }

            @Override
            public boolean isUserInRole(String role) {
                return principal.getRoles().contains(role);
            }

            @Override
            public String getRemoteUser() {
                return principal.getName();
            }
        };
        return wrapper;
    }
809460
public CmsJspResourceWrapper getWrap() {

        if (m_resourceWrapper == null) {
            m_resourceWrapper = CmsJspResourceWrapper.wrap(m_cms, m_resource);
        }
        return m_resourceWrapper;
    }
284678
public static ContainerWrapper getContainer(HttpServletRequest request) throws Exception {
		ContainerFinderImp scf = new ContainerFinderImp();
		ServletContext sc = request.getSession().getServletContext();
		return scf.findContainer(new ServletContextWrapper(sc));
	}
292664
public ServletRequest getServletRequest()
    {
        RequestContext reqContext = peekRequestContext();
        if (reqContext == null)
            return null;

        return  reqContext._request;
    }
10773
static void preHandleMultipartRequest(HttpServletRequest request)
        throws ServletException
    {
        MultipartRequestHandler multipartHandler = getCachedMultipartHandler(request);
        
        if (multipartHandler == null)
        {
            multipartHandler = getMultipartHandler(request);
            
            if (multipartHandler != null)
            {
                //
                // Run the request through the handler, and cache the handler in the outer request.
                //
                multipartHandler.handleRequest(request);
                HttpServletRequest outerRequest = ScopedServletUtils.getOuterRequest(request);
                outerRequest.setAttribute(PREHANDLED_MULTIPART_REQUEST_ATTR, multipartHandler);
            }
        }
    }
690323
function RequestWrapper(req) {
  this.request = req;
  this.method = req.method;
  this.url = req.url;
  this.body = req._data;
  this.headers = req._header;
}
1159974
public static HttpSession getHttpSession()
	{
		final HttpServletRequest request = WicketComponentExtensions.getHttpServletRequest();
		if (request != null)
		{
			final HttpSession session = request.getSession(false);
			if (session != null)
			{
				return session;
			}
		}
		return null;
	}
128237
protected TranWrapper getCurrentTranWrapper() throws ResourceException {

        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "getCurrentTranWrapper");
        }

        // If the MCWrapper has not been completely initialized and we are working with an RA
        // that supports deferred enlistment of transactions, then let's re-initialize for the
        // UOW which we are already involved with.
        // This was a special fix that was put in for JMS Managed Sessions, but it
        // could apply to other internal connection types that might require this support.
        if ((state == STATE_ACTIVE_INUSE) && (gConfigProps.isDynamicEnlistmentSupported())) {
            if (isTracingEnabled && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "State is STATE_ACTIVE_INUSE, calling initializeForUOW()...");
            }
            cm.initializeForUOW(this, true); // second parm indicates source of call is deferred enlistment.
        }

        if ((state != STATE_TRAN_WRAPPER_INUSE) && (state != STATE_ACTIVE_INUSE)) {
            IllegalStateException e = new IllegalStateException("getCurrentTranWrapper: illegal state exception. State = " + getStateString() + " MCW = "
                                                                + mcWrapperObject_hexString);
            Object[] parms = new Object[] { "getCurrentTranWrapper", e };
            Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
            throw e;
        }

        TranWrapper tranWrapper = null;
        switch (tranWrapperInUse) {
            case XATXWRAPPER:
                tranWrapper = xaTranWrapper;
                break;
            case LOCALTXWRAPPER:
                tranWrapper = localTranWrapper;
                break;
            case NOTXWRAPPER:
                tranWrapper = noTranWrapper;
                break;
            case RRSGLOBALTXWRAPPER:
                tranWrapper = rrsGlobalTranWrapper;
                break;
            case RRSLOCALTXWRAPPER:
                tranWrapper = rrsLocalTranWrapper;
                break;
            default:
                // Need RAS and Trace here.
                IllegalStateException e = new IllegalStateException("getCurrentTranWrapper: illegal transaction state exception. State = "
                                                                    + getTranWrapperString());
                Object[] parms = new Object[] { "getCurrentTranWrapper", e };
                Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
                throw e;
        }

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "getCurrentTranWrapper", getTranWrapperString());
        }

        return tranWrapper;
    }
650319
public static function parseWrapper(DataTablesWrapperInterface $wrapper, Request $request) {
        $wrapper->setRequest(static::parseRequest($wrapper, $request));
        $wrapper->setResponse(static::newResponse($wrapper));
    }