public void readCookies ( HttpURLConnection http ) { // Only save cookies if FLAGS_ENABLE_COOKIES has been set. if ( ( flags & XMLRPCClient . FLAGS_ENABLE_COOKIES ) == 0 ) return ; String cookie , key ; String [ ] split ; // Extract every Set-Cookie field and put the cookie to the cookies map. for ( int i = 0 ; i < http . getHeaderFields ( ) . size ( ) ; i ++ ) { key = http . getHeaderFieldKey ( i ) ; if ( key != null && SET_COOKIE . equalsIgnoreCase ( key . toLowerCase ( ) ) ) { cookie = http . getHeaderField ( i ) . split ( ";" ) [ 0 ] ; split = cookie . split ( "=" ) ; if ( split . length >= 2 ) cookies . put ( split [ 0 ] , split [ 1 ] ) ; } } }
Read the cookies from an http response . It will look at every Set - Cookie header and put the cookie to the map of cookies .