List of usage examples for org.apache.http.cookie SetCookie setVersion
void setVersion(int version);
From source file:com.gargoylesoftware.htmlunit.httpclient.HtmlUnitVersionAttributeHandler.java
/** * Parse cookie version attribute./*from w w w .j a v a 2 s .c o m*/ */ @Override public void parse(final SetCookie cookie, final String value) throws MalformedCookieException { if (value == null) { throw new MalformedCookieException("Missing value for version attribute"); } int version = 0; try { version = Integer.parseInt(value); } catch (final NumberFormatException e) { // ignore invalid versions } cookie.setVersion(version); }
From source file:org.nextlets.erc.defaults.http.ERCHttpInvokerImpl.java
private Cookie toCookie(URI uri, HttpCookie httpCookie) { SetCookie cookie = new BasicClientCookie(httpCookie.getName(), httpCookie.getValue()); cookie.setComment(httpCookie.getComment()); if (httpCookie.getDomain() != null) { cookie.setDomain(httpCookie.getDomain()); } else {/* www . java 2 s . c o m*/ cookie.setDomain(uri.getHost()); } if (httpCookie.getMaxAge() != -1) { cookie.setExpiryDate(new Date(httpCookie.getMaxAge() * 1000)); } if (httpCookie.getPath() != null) { cookie.setPath(httpCookie.getPath()); } else { cookie.setPath(uri.getPath()); } cookie.setSecure(httpCookie.getSecure()); cookie.setVersion(httpCookie.getVersion()); return cookie; }