Invokes an override for a method.
@param req The request
@param cookie The cookie
@return The method's return value
13953
private JsonNode invokeCallbackMethod(final InvokeRequest req, final String cookie) {
        Object obj = this.getObject(req.getObjref());
        Method method = this.findCallbackMethod(obj.getClass(), cookie);

        final Class<?>[] argTypes = method.getParameterTypes();
        final Object[] args = new Object[argTypes.length];
        for (int i = 0; i < argTypes.length; i++) {
            args[i] = JsiiObjectMapper.treeToValue(req.getArgs().get(i), argTypes[i]);
        }

        return JsiiObjectMapper.valueToTree(invokeMethod(obj, method, args));
    }
1325280
private void performAdjustCookies(HttpServletRequest request, HttpServletResponse response) throws Exception {

		boolean loggedIn = false;
		User user = null;
		try {
			Cookie cookie = getCookieFromRequest(request);
			if( null != cookie ) {
				user = CookieAuthentication.verifyCookieString(userRepository, cookie.getValue());
				loggedIn = true;
			}
		} catch(Exception e) {
			// Ignore
		}
		
		if( null == user ) {
			user = userRepository.getDefaultUser();
		}
		
		acceptRequest(response, loggedIn, user);
	}
368981
@Sensitive
    public String getReferrerURLFromCookies(HttpServletRequest req, String cookieName) {
        Cookie[] cookies = req.getCookies();
        String referrerURL = CookieHelper.getCookieValue(cookies, cookieName);
        if (referrerURL != null) {
            StringBuffer URL = req.getRequestURL();
            referrerURL = decodeURL(referrerURL);
            referrerURL = restoreHostNameToURL(referrerURL, URL.toString());
        }
        return referrerURL;
    }
663752
public static void resetCookieValue(HttpServletResponse response, String cookieName) {
        Cookie cookie = new Cookie(cookieName, null);
        cookie.setMaxAge(0);
        response.addCookie(cookie);
    }
1250056
public Object createContext(ApplicationRequest request,
                                ApplicationResponse response) {
        
        return new CookieContext(
            request, response, mDomain, mPath, mIsSecure);
    }
817323
public static Cookie getCookie(String name, HttpServletRequest request) {
        return getCookie(name, request.getCookies());
    }
757249
public static Cookie getCookie(HttpServletRequest request, String name) {
    Cookie[] cookies = request.getCookies();
    Cookie returnCookie = null;

    if (cookies == null) { return returnCookie; }
    for (int i = 0; i < cookies.length; i++) {
      Cookie thisCookie = cookies[i];
      if (thisCookie.getName().equals(name) && !thisCookie.getValue().equals("")) {
        returnCookie = thisCookie;
        break;
      }
    }
    return returnCookie;
  }
1337719
public HttpCookie getCookie(String name) {
		List<HttpCookie> cookie = getCookies();
		if (null != cookie) {
			for (HttpCookie httpCookie : cookie) {
				if (httpCookie.getName().equals(name)) {
					return httpCookie;
				}
			}
		}
		return null;
	}
1257467
public static String getCookieValue(HttpServletRequest request, String cookieName) {
    try {
      Cookie cookie = getCookie(request, cookieName);
      if (null == cookie) {
        return null;
      } else {
        return URLDecoder.decode(cookie.getValue(), "utf-8");
      }
    } catch (Exception e) {
      return null;
    }
  }
544962
public Cookie getCookieObject(String name) {
		Cookie[] cookies = request.getCookies();
		if (cookies != null)
			for (Cookie cookie : cookies)
				if (cookie.getName().equals(name))
					return cookie;
		return null;
	}
271521
protected static Cookie getCookie(HttpServletRequest request, String name) {

        Cookie[] cookies = request.getCookies();
        for (int i = 0; (cookies != null) && (i < cookies.length); i++) {
            if (name.equalsIgnoreCase(cookies[i].getName())) {
                return cookies[i];
            }
        }
        return new Cookie(name, "");
    }
375782
@SuppressWarnings("rawtypes")
	private void restoreFromCookie(IExtendedRequest extRequest, HttpServletResponse res, String reqURL) {
		byte[] cookieValueBytes = extRequest.getCookieValueAsBytes(POSTPARAM_COOKIE);
		if (cookieValueBytes == null || cookieValueBytes.length <= 2) {
			return;
		}
		if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
			Tr.debug(tc, "Found the cookie, restoring POST parameters: " + new String(cookieValueBytes));
		}
		try {
			HashMap restoredParams = deserializePostParam(extRequest, cookieValueBytes, reqURL);
			extRequest.setInputStreamData(restoredParams);
			extRequest.setMethod("POST");
		} catch (Exception e) {
			if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
				Tr.debug(tc, "Exception restoring POST parameters from the cookie: ", new Object[] { e });
			}
		}
		Cookie paramCookie = new Cookie(POSTPARAM_COOKIE, "");
		paramCookie.setPath(reqURL);
		paramCookie.setMaxAge(0);
		if (webAppSecurityConfig.getHttpOnlyCookies()) {
			paramCookie.setHttpOnly(true);
		}
		if (webAppSecurityConfig.getSSORequiresSSL()) {
			paramCookie.setSecure(true);
		}
		res.addCookie(paramCookie);
	}
1352067
public Cookie getSessionCookie(HttpSession session,boolean requestIsSecure)
    {
        if (_handler.isUsingCookies())
        {
            Cookie cookie = _handler.getSessionManager().getHttpOnly()
                ?new HttpOnlyCookie(SessionManager.__SessionCookie,session.getId())
                :new Cookie(SessionManager.__SessionCookie,session.getId());    
            String domain=_handler.getServletContext().getInitParameter(SessionManager.__SessionDomain);
            String maxAge=_handler.getServletContext().getInitParameter(SessionManager.__MaxAge);
            String path=_handler.getServletContext().getInitParameter(SessionManager.__SessionPath);
            if (path==null)
                path=getCrossContextSessionIDs()?"/":_handler.getHttpContext().getContextPath();
            if (path==null || path.length()==0)
                path="/";
            
            if (domain!=null)
                cookie.setDomain(domain);       
            if (maxAge!=null)
                cookie.setMaxAge(Integer.parseInt(maxAge));
            else
                cookie.setMaxAge(-1);
            
            cookie.setSecure(requestIsSecure && getSecureCookies());
            cookie.setPath(path);
            
            return cookie;    
        }
        return null;
    }
361853
public void sessionCheck(HttpServletRequest req) {
        String authHeader = req.getHeader("Authorization");
        if (authHeader != null && this.validationSessionCheck(authHeader)) {
            return;
        }

        if (req.getCookies() != null) {
            Cookie cookie = Arrays.stream(req.getCookies()).filter(ck -> ck.getName().equals("AuthToken")).findFirst().orElse(null);
            if (cookie != null && this.validationSessionCheck(cookie.getValue())) {
                return;
            }
        }

        if ( req.getParameter("token") != null){
            String token = req.getParameter("token");
            if(this.validationSessionCheck(token)){
                return;
            }
        }

        throw new ValidationLibException("UnAuthorization", HttpStatus.UNAUTHORIZED);
    }
604856
function (id, request, protocolProfileBehavior, callback) {
        var self = this,
            cookieJar,
            requestOptions,
            networkOptions = self.options.network || {},
            startTime = Date.now(),
            startTimer = now(), // high-resolution time
            hostname,

            complete = function (error, response, cookies, history) {
                self.emit(id, error, self.trace.cursor, self.trace, response, request, cookies, history);

                return callback(error, response, request, cookies, history);
            };

        // at this point the request could have come from collection, auth or sandbox
        // we can't trust the integrity of this request
        // bail out if request url is empty
        if (!(request && request.url && request.url.toString && request.url.toString())) {
            return complete(new Error('runtime:extenstions~request: request url is empty'));
        }

        cookieJar = self.options.cookieJar;
        requestOptions = core.getRequestOptions(request, self.options, protocolProfileBehavior);
        hostname = request.url.getHost();

        // check if host is on the `restrictedAddresses`
        if (networkOptions.restrictedAddresses && core.isAddressRestricted(hostname, networkOptions)) {
            return complete(new Error(ERROR_RESTRICTED_ADDRESS + hostname));
        }

        return requests(request, requestOptions, function (err, res, resBody, debug) {
            if (err) {
                // bubble up http errors
                // @todo - Should we send an empty sdk Response here?
                return complete(err);
            }

            var responseString,
                responseTime,
                responseJSON,
                keepAlive,
                response,
                cookies,
                header,
                history = {
                    execution: {
                        verbose: Boolean(requestOptions.verbose),
                        sessions: requestOptions.verbose ? {} : undefined,
                        data: []
                    }
                };

            // holds the response as a string
            // eslint-disable-next-line lodash/prefer-is-nil
            responseString = ((resBody !== null && resBody !== undefined) && resBody.toString) ?
                resBody.toString() : resBody;
            if (responseString === '[object ArrayBuffer]') {
                responseString = core.arrayBufferToString(resBody);
            }

            // This helps us to unify the information from XHR or Node calls.
            responseJSON = core.jsonifyResponse(res, requestOptions, responseString);

            // Pull out cookies from the cookie jar, and make them chrome compatible.
            cookies = (cookieJar && _.isFunction(cookieJar.getCookies)) ?
                _.transform(cookieJar.getCookies(requestOptions.url), function (acc, cookie) {
                    acc.push(toChromeCookie(cookie));
                }, []) : [];

            // Calculate the time taken for us to get the response.
            responseTime = Date.now() - startTime;

            if (res && res.timings) {
                // update response time to actual response end time
                // of the final request in the redirect chain.
                responseTime = Math.ceil(res.timings.end);
            }

            // prepare history from request debug data
            if (Array.isArray(debug)) {
                debug.forEach(function (debugData) {
                    // cache connection sessions, to be referred later
                    if (debugData.session && !debugData.session.reused) {
                        history.execution.sessions[debugData.session.id] = debugData.session.data;
                    }

                    history.execution.data.push({
                        request: debugData.request,
                        response: debugData.response,
                        timings: debugData.timings && {
                            // runtime start time
                            start: startTime,
                            // request start time
                            requestStart: debugData.timingStart,
                            // offsets calculated are relative to runtime start time
                            offset: calcTimingsOffset(startTimer, debugData.timingStartTimer, debugData.timings)
                        },
                        session: debugData.session && {
                            id: debugData.session.id,
                            // is connection socket reused
                            reused: debugData.session.reused
                        }
                    });
                });
            }

            // Response in the SDK format
            response = new sdk.Response({ // @todo get rid of jsonifyResponse
                code: responseJSON.statusCode,
                status: res && res.statusMessage,
                header: _.transform(responseJSON.headers, transformMultiValueHeaders, []),
                stream: resBody,
                responseTime: responseTime
            });

            // Insert the missing sent headers in the request object, so that they get bubbled up into the UI
            _.forOwn(responseJSON.request && responseJSON.request.headers, function (value, key) {
                header = request.headers.one(key);

                // neither request nor runtime overwrites user-defined headers
                // so instead of upsert, just add missing headers to the list
                // with system: true flag.
                if (!header) {
                    request.headers.add({key: key, value: value, system: true});

                    return;
                }

                // update headers which gets overwritten by the requester
                if (OVERWRITTEN_HEADERS[key.toLowerCase()] && value !== header.value) {
                    header.update({key: key, value: value, system: true});
                }
            });

            keepAlive = _.get(requestOptions, 'agentOptions.keepAlive');

            // @note Connection header is added by Node based on the agent's
            // keepAlive option. Don't add if custom is defined already.
            if (!request.headers.has(CONNECTION_HEADER.key)) {
                request.headers.add({
                    key: CONNECTION_HEADER.key,
                    value: keepAlive ? CONNECTION_HEADER.keepAlive : CONNECTION_HEADER.close,
                    system: true
                });
            }

            complete(null, response, cookies, history);
        });
    }
331692
public static Cookie getCookie(final String name)
	{
		return ((WebRequest)RequestCycle.get().getRequest()).getCookie(name);
	}
139891
def get_cookie_header(self, req):
        
        mocked_req = MockRequest(req)
        self.cookiejar.add_cookie_header(mocked_req)
        return mocked_req.get_new_headers().get('Cookie')