<p>
This method also sets and clears a thread-local reference to the incoming {@link HttpServletRequest request}.
</p>
773475
@Override
    protected void service( HttpServletRequest req,
                            HttpServletResponse resp ) throws ServletException, IOException {
        ModeShapeWebdavStore.setRequest(req);
        try {
            super.service(req, resp);
        } finally {
            ModeShapeWebdavStore.setRequest(null);
        }
    }
694657
public void service(ConnectionProtocol request)
  {
    RequestBaratine req = (RequestBaratine) request;
    
    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();
    
    try {
      if (_webApp != null) {
        thread.setContextClassLoader(_webApp.classLoader());
      }
      
      for (RouteBaratine route : _routes) {
        if (route.service(req)) {
          return;
        }
      }
      
      if (_routes.length > 0) {
        req.halt(HttpStatus.METHOD_NOT_ALLOWED);
      }
      else {
        req.halt(HttpStatus.NOT_FOUND);
        
      }
    } finally {
      thread.setContextClassLoader(oldLoader);
    }
  }
627695
public static boolean isHttpPostRequest(HttpServletRequest request) {
        boolean isSane = isSaneRequest(request);
        boolean isPost = isSane && request.getMethod().equals(HttpMethod.POST.toString());
        return isSane && isPost;
    }
1194074
public static void removeRequest (@Nonnull @Nonempty final String sRequestID)
  {
    final RequestTracker aTracker = getGlobalSingletonIfInstantiated (RequestTracker.class);
    if (aTracker != null)
      aTracker.m_aRequestTrackingMgr.removeRequest (sRequestID, s_aParallelRunningCallbacks);
  }
776983
public static void clearGrailsWebRequest() {
        RequestAttributes reqAttrs = RequestContextHolder.getRequestAttributes();
        if (reqAttrs != null) {
            // First remove the web request from the HTTP request attributes.
            GrailsWebRequest webRequest = (GrailsWebRequest) reqAttrs;
            webRequest.getRequest().removeAttribute(GrailsApplicationAttributes.WEB_REQUEST);

            // Now remove it from RequestContextHolder.
            RequestContextHolder.resetRequestAttributes();
        }
    }
1356583
public final void removeThreadLocal(Object key)
    {
        if (sealed) onSealedMutation();
        if (threadLocalMap == null)
            return;
        threadLocalMap.remove(key);
    }
507520
private void sendRequest(Object request, ContextualFuture future) {
    if (open && connection.open) {
      long requestId = ++this.requestId;
      futures.put(requestId, future);
      connection.handleRequest(requestId, request);
    } else {
      future.context.executor().execute(() -> future.completeExceptionally(new ConnectException("connection closed")));
    }

    if (request instanceof ReferenceCounted) {
      ((ReferenceCounted<?>) request).release();
    }
  }
749254
@Override
  protected void initRequest()
  {
    super.initRequest();

    _uri.clear();
    _host.clear();
    _headerSize = 0;

    _remoteHost.clear();
    _remoteAddr.clear();
    _serverName.clear();
    _serverPort.clear();
    _remotePort.clear();

    _clientCert.clear();
    
    // _isSecure = getConnection().isSecure();
  }
151631
public static HttpServletRequest getOuterRequest( HttpServletRequest request )
    {
        ScopedRequest scopedRequest = unwrapRequest( request );
        return scopedRequest != null ? scopedRequest.getOuterRequest() : request;
    }
731433
public void setRequest(HttpServletRequest request) {
		WaybackRequest wbRequest = new WaybackRequest();
		wbRequest.extractHttpRequestInfo(request);
		this.wbRequest = wbRequest;
	}
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);
            }
        }
    }
869379
public void removeClientNotificationListener(RESTRequest request, ObjectName name) {
        NotificationTargetInformation nti = toNotificationTargetInformation(request, name.getCanonicalName());

        // Remove locally
        ClientNotificationListener listener = listeners.remove(nti);

        // Check whether the producer of the notification is local or remote.
        if (nti.getRoutingInformation() == null) {
            // Remove the notification from the MBeanServer
            MBeanServerHelper.removeClientNotification(name, listener);
        } else {
            // Remove the notification listener from the Target-Client Manager through EventAdmin
            MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
            helper.removeRoutedNotificationListener(nti, listener);
        }
    }
1044518
public MockServerClient clear(HttpRequest httpRequest) {
        sendRequest(request().withMethod("PUT").withPath(calculatePath("clear")).withBody(httpRequest != null ? httpRequestSerializer.serialize(httpRequest) : "", StandardCharsets.UTF_8));
        return clientClass.cast(this);
    }
470242
@Override
    public void setRequest(HttpRequestMessage msg) throws IllegalRequestObjectException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "setRequest: " + msg);
        }

        // null message isn't allowed
        if (null == msg) {
            throw new IllegalRequestObjectException("Illegal null message");
        }

        HttpRequestMessageImpl temp = null;
        try {
            temp = (HttpRequestMessageImpl) msg;
        } catch (ClassCastException cce) {
            // no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Non msg impl passed to setRequest");
            }
            throw new IllegalRequestObjectException("Invalid message provided");
        }
        // possibly clean up any existing request object
        if (null != getMyRequest() && isRequestOwner()) {
            if (!getMyRequest().equals(temp)) {
                getMyRequest().destroy();
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Caller overlaying same message");
                }
            }
        }
        // set the new object in place
        setMyRequest(temp);
        // 335554 : the message init() will overwrite the version based on config
        // and needs to be reset back to whatever we started with here.
        VersionValues version = temp.getVersionValue();
        getMyRequest().init(this);
        getMyRequest().setVersion(version);
        updatePersistence(getMyRequest());
        getResponseImpl().setHeaderChangeLimit(getMyRequest().getHeaderChangeLimit());

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "setRequest");
        }
    }
1043805
@Override
  public void onAccept()
  {
    if (_request != null) {
      System.out.println("OLD_REQUEST: " + _request);
    }
    
    _sequenceClose.set(-1);
    /*
    _request = protocol().newRequest(this);
    _request.onAccept();
    */
  }
65564
protected void clearThreadStorage() {

        if (m_perThreadCmsObject != null) {
            m_perThreadCmsObject.remove();
        }
        if (perThreadRequest != null) {
            perThreadRequest.remove();
        }
        if (perThreadResponse != null) {
            perThreadResponse.remove();
        }
    }
1349210
@Override
    public void clear() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Clearing this request: " + this);
        }
        super.clear();
        this.myMethod = MethodValues.UNDEF;
        this.myScheme = null;
        this.myURIBytes = SLASH;
        this.myURIString = null;
        this.myQueryBytes = null;
        this.queryParams = null;
        this.sUrlHost = null;
        this.sHdrHost = null;
        this.iUrlPort = HeaderStorage.NOTSET;
        this.iHdrPort = NOT_TESTED;
    }