public void addTokenWithEqualsSign(CookieRecipe recipe, String token, int equalsIndex) { final String name = token.substring(0, equalsIndex).trim(); final String value = token.substring(equalsIndex + 1).trim(); StringBuffer _value = getFieldValue("_value", StringBuffer.class); _value.insert(0, value); HashMap _attributes = getFieldValue("_attributes", HashMap.class); if (recipe.isCookieAttribute(name.toLowerCase())) { _attributes.put(name.toLowerCase(), _value.toString()); } else { try { getAccessibleMethod(CookiePress.class, "addCookieIfValid", new Class[] { Cookie.class }).invoke(this, new Cookie(name, _value.toString(), _attributes)); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } _attributes.clear(); } _value.setLength(0); }
public void addTokenWithEqualsSign(CookieRecipe recipe, String token, int equalsIndex) { final String name = token.substring(0, equalsIndex).trim(); final String value = token.substring(equalsIndex + 1).trim(); StringBuffer _value = getFieldValue("_value", StringBuffer.class); _value.insert(0, value); HashMap _attributes = getFieldValue("_attributes", HashMap.class); if (recipe.isCookieAttribute(name.toLowerCase())) { _attributes.put(name.toLowerCase(), _value.toString()); } else { try { getAccessibleMethod(CookiePress.class, "addCookieIfValid", new Class[] { Cookie.class }).invoke(this, new Cookie(name, _value.toString(), _attributes)); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } _attributes.clear(); } _value.setLength(0); }
/** * Defines a cookie to be sent to the server on every request. This bypasses the normal mechanism by which only * certain cookies are sent based on their host and path. * @deprecated as of 1.6, use #putCookie **/ public void addCookie( String name, String value ) { _globalCookies.add( new Cookie( name, value ) ); }
/** * Defines a cookie to be sent to the server on every request. This bypasses the normal mechanism by which only * certain cookies are sent based on their host and path. * @deprecated as of 1.6, use #putCookie **/ public void addCookie( String name, String value ) { _globalCookies.add( new Cookie( name, value ) ); }
/** * Defines a cookie to be sent to the server on every request. This bypasses the normal mechanism by which only * certain cookies are sent based on their host and path. * @deprecated as of 1.6, use #putCookie **/ public void addCookie( String name, String value ) { _globalCookies.add( new Cookie( name, value ) ); }
/** * Define a non-global cookie. This cookie can be overwritten by subsequent cookie definitions * in http headers. This cookie definition requires a domain and path. If a global cookie is * defined with the same name, this cookie is not added. */ public void putSingleUseCookie(String name, String value, String domain, String path) { for (Iterator iterator = _globalCookies.iterator(); iterator.hasNext();) { Cookie cookie = (Cookie) iterator.next(); if (name.equals( cookie.getName() )) return; } for (Iterator iterator = _cookies.iterator(); iterator.hasNext();) { Cookie cookie = (Cookie) iterator.next(); if (name.equals( cookie.getName() )) iterator.remove(); } _cookies.add( new Cookie( name, value, domain, path) ); }
/** * Define a non-global cookie. This cookie can be overwritten by subsequent cookie definitions * in http headers. This cookie definition requires a domain and path. If a global cookie is * defined with the same name, this cookie is not added. */ public void putSingleUseCookie(String name, String value, String domain, String path) { for (Iterator iterator = _globalCookies.iterator(); iterator.hasNext();) { Cookie cookie = (Cookie) iterator.next(); if (name.equals( cookie.getName() )) return; } for (Iterator iterator = _cookies.iterator(); iterator.hasNext();) { Cookie cookie = (Cookie) iterator.next(); if (name.equals( cookie.getName() )) iterator.remove(); } _cookies.add( new Cookie( name, value, domain, path) ); }
/** * add from a token * @param recipe - the recipe to use * @param token - the token to use * @param equalsIndex - the position of the equal sign */ void addTokenWithEqualsSign( CookieRecipe recipe, String token, int equalsIndex ) { String name = token.substring( 0, equalsIndex ).trim(); String value= token.substring( equalsIndex + 1 ).trim(); _value.insert( 0, value ); if (recipe.isCookieAttribute( name.toLowerCase() )) { _attributes.put( name.toLowerCase(), _value.toString() ); } else { addCookieIfValid( new Cookie( name, _value.toString(), _attributes ) ); _attributes.clear(); } _value.setLength(0); }
/** * add from a token * @param recipe - the recipe to use * @param token - the token to use * @param equalsIndex - the position of the equal sign */ void addTokenWithEqualsSign( CookieRecipe recipe, String token, int equalsIndex ) { String name = token.substring( 0, equalsIndex ).trim(); String value= token.substring( equalsIndex + 1 ).trim(); _value.insert( 0, value ); if (recipe.isCookieAttribute( name.toLowerCase() )) { _attributes.put( name.toLowerCase(), _value.toString() ); } else { addCookieIfValid( new Cookie( name, _value.toString(), _attributes ) ); _attributes.clear(); } _value.setLength(0); }
/** * add from a token * @param recipe - the recipe to use * @param token - the token to use * @param equalsIndex - the position of the equal sign */ void addTokenWithEqualsSign( CookieRecipe recipe, String token, int equalsIndex ) { String name = token.substring( 0, equalsIndex ).trim(); String value= token.substring( equalsIndex + 1 ).trim(); _value.insert( 0, value ); if (recipe.isCookieAttribute( name.toLowerCase() )) { _attributes.put( name.toLowerCase(), _value.toString() ); } else { addCookieIfValid( new Cookie( name, _value.toString(), _attributes ) ); _attributes.clear(); } _value.setLength(0); }
/** * Define a non-global cookie. This cookie can be overwritten by subsequent cookie definitions * in http headers. This cookie definition requires a domain and path. If a global cookie is * defined with the same name, this cookie is not added. */ public void putSingleUseCookie(String name, String value, String domain, String path) { for (Iterator iterator = _globalCookies.iterator(); iterator.hasNext();) { Cookie cookie = (Cookie) iterator.next(); if (name.equals( cookie.getName() )) return; } for (Iterator iterator = _cookies.iterator(); iterator.hasNext();) { Cookie cookie = (Cookie) iterator.next(); if (name.equals( cookie.getName() )) iterator.remove(); } _cookies.add( new Cookie( name, value, domain, path) ); }
_globalCookies.add( new Cookie( name, value ) );
_globalCookies.add( new Cookie( name, value ) );
_globalCookies.add( new Cookie( name, value ) );