cookie.setVersion(Integer.parseInt(paramValue)); } catch (NumberFormatException e) { throw new MalformedCookieException("Invalid version: "
private org.apache.commons.httpclient.Cookie toHttpClientCookie(Cookie cookie) { org.apache.commons.httpclient.Cookie internal = new org.apache.commons.httpclient.Cookie(); internal.setName(cookie.getName()); internal.setValue(cookie.getValue()); internal.setComment(cookie.getComment()); internal.setDomain(cookie.getDomain()); // internal.setExpiryDate(toExpiry(cookie.getMaxAge())); internal.setPath(cookie.getPath()); internal.setVersion(cookie.getVersion()); return internal; }
cookie.setVersion(Integer.parseInt(paramValue)); } catch (NumberFormatException e) { throw new MalformedCookieException("Invalid version: "
cookie.setVersion(Integer.parseInt(paramValue)); } catch (NumberFormatException e) { throw new MalformedCookieException("Invalid version: "
cookie.setVersion(Integer.parseInt(paramValue)); } catch (NumberFormatException e) { throw new MalformedCookieException("Invalid version: "
cookie.setVersion(Integer.parseInt(paramValue)); } catch (NumberFormatException e) { throw new MalformedCookieException("Invalid version: "
public Cookie createCookie() throws ParseException { Cookie cookie = new Cookie(); cookie.setName(getName()); cookie.setValue(getValue()); cookie.setDomain(domain); cookie.setPath(path); if(expiryDate != null) { cookie.setExpiryDate(formatExpiryDate(expiryDate)); } if(maxAge != null && expiryDate == null) { cookie.setExpiryDate(new Date(System.currentTimeMillis() + Integer.valueOf(maxAge) * 1000L)); } if(secure != null) { cookie.setSecure(Boolean.valueOf(secure)); } if(version != null) { cookie.setVersion(Integer.valueOf(version)); } return cookie; }
private Cookie convertCookie(HttpCookie cookie) { Cookie c = new Cookie(cookie.getDomain(), cookie.getName(), cookie.getValue(), cookie.getPath(), (int) cookie.getMaxAge(), cookie.getSecure()); c.setVersion(cookie.getVersion()); c.setComment(cookie.getComment()); return c; }
/** * Transforms a {@link ServerCookie} (from Apache Tomcat) into a {@link Cookie} * (from commons httpclient). Both types of Cookie hold the same data but the * {@link ServerCookie} is the type that you get when parsing cookies as a * Server. */ protected static Cookie transformServerCookieToClientCookie(ServerCookie serverCookie) { Cookie clientCookie = new Cookie(serverCookie.getDomain().toString(), serverCookie.getName() .toString(), serverCookie.getValue().toString(), serverCookie.getPath().toString(), serverCookie.getMaxAge(), serverCookie.getSecure()); clientCookie.setComment(serverCookie.getComment().toString()); clientCookie.setVersion(serverCookie.getVersion()); return clientCookie; }