@ 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 ) ; }
Restore POST parameter from cookie