protected void setCookies ( HttpServletRequest request , HttpServletResponse response , String requestToken , String stateValue ) { ReferrerURLCookieHandler referrerURLCookieHandler = WebAppSecurityCollaboratorImpl . getGlobalWebAppSecurityConfig ( ) . createReferrerURLCookieHandler ( ) ; // Create cookie for request token Cookie requestTokenCookie = referrerURLCookieHandler . createCookie ( TwitterConstants . COOKIE_NAME_REQUEST_TOKEN , requestToken , request ) ; response . addCookie ( requestTokenCookie ) ; // Set original request URL in cookie String cookieName = ClientConstants . COOKIE_NAME_REQ_URL_PREFIX + stateValue . hashCode ( ) ; Cookie c = referrerURLCookieHandler . createCookie ( cookieName , webUtils . getRequestUrlWithEncodedQueryString ( request ) , request ) ; response . addCookie ( c ) ; }
Sets cookies for the provided request token and the original request URL . These values can then be verified and used in subsequent requests .