/** * Returns the value of the specified cookie. * @param name - the name of the cookie to get the value for * @return the value of the cookie **/ public String getCookieValue( String name ) { Cookie cookie = getCookie( name ); return cookie == null ? null : cookie.getValue(); }
/** * Returns the value of the specified cookie. * @param name - the name of the cookie to get the value for * @return the value of the cookie **/ public String getCookieValue( String name ) { Cookie cookie = getCookie( name ); return cookie == null ? null : cookie.getValue(); }
/** * Returns the value of the specified cookie. * @param name - the name of the cookie to get the value for * @return the value of the cookie **/ public String getCookieValue( String name ) { Cookie cookie = getCookie( name ); return cookie == null ? null : cookie.getValue(); }
/** * Returns the value of the cookie header to be sent to the specified URL. * Will return null if no compatible cookie is defined. **/ public String getCookieHeaderField( URL targetURL ) { if (_cookies.isEmpty() && _globalCookies.isEmpty()) return null; StringBuffer sb = new StringBuffer( DEFAULT_HEADER_SIZE ); HashSet restrictedCookies = new HashSet(); for (Iterator i = _cookies.iterator(); i.hasNext();) { Cookie cookie = (Cookie) i.next(); if (!cookie.mayBeSentTo( targetURL )) continue; restrictedCookies.add( cookie.getName() ); if (sb.length() != 0) sb.append( "; " ); sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() ); } for (Iterator i = _globalCookies.iterator(); i.hasNext();) { Cookie cookie = (Cookie) i.next(); if (restrictedCookies.contains( cookie.getName() )) continue; if (sb.length() != 0) sb.append( "; " ); sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() ); } return sb.length() == 0 ? null : sb.toString(); }
/** * Returns the value of the cookie header to be sent to the specified URL. * Will return null if no compatible cookie is defined. **/ public String getCookieHeaderField( URL targetURL ) { if (_cookies.isEmpty() && _globalCookies.isEmpty()) return null; StringBuffer sb = new StringBuffer( DEFAULT_HEADER_SIZE ); HashSet restrictedCookies = new HashSet(); for (Iterator i = _cookies.iterator(); i.hasNext();) { Cookie cookie = (Cookie) i.next(); if (!cookie.mayBeSentTo( targetURL )) continue; restrictedCookies.add( cookie.getName() ); if (sb.length() != 0) sb.append( "; " ); sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() ); } for (Iterator i = _globalCookies.iterator(); i.hasNext();) { Cookie cookie = (Cookie) i.next(); if (restrictedCookies.contains( cookie.getName() )) continue; if (sb.length() != 0) sb.append( "; " ); sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() ); } return sb.length() == 0 ? null : sb.toString(); }
/** * Returns the value of the cookie header to be sent to the specified URL. * Will return null if no compatible cookie is defined. **/ public String getCookieHeaderField( URL targetURL ) { if (_cookies.isEmpty() && _globalCookies.isEmpty()) return null; StringBuffer sb = new StringBuffer( DEFAULT_HEADER_SIZE ); HashSet restrictedCookies = new HashSet(); for (Iterator i = _cookies.iterator(); i.hasNext();) { Cookie cookie = (Cookie) i.next(); if (!cookie.mayBeSentTo( targetURL )) continue; restrictedCookies.add( cookie.getName() ); if (sb.length() != 0) sb.append( "; " ); sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() ); } for (Iterator i = _globalCookies.iterator(); i.hasNext();) { Cookie cookie = (Cookie) i.next(); if (restrictedCookies.contains( cookie.getName() )) continue; if (sb.length() != 0) sb.append( "; " ); sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() ); } return sb.length() == 0 ? null : sb.toString(); }