private void addCookie(Cookie cookie) { cookies.add(new SavedCookie(cookie)); }
public Cookie getCookie() { Cookie c = new Cookie(getName(), getValue()); if (getComment() != null) c.setComment(getComment()); if (getDomain() != null) c.setDomain(getDomain()); if (getPath() != null) c.setPath(getPath()); c.setVersion(getVersion()); c.setMaxAge(getMaxAge()); c.setSecure(isSecure()); return c; } }
@Override public List<Cookie> getCookies() { List<Cookie> cookieList = new ArrayList<Cookie>(cookies.size()); for (SavedCookie savedCookie : cookies) { cookieList.add(savedCookie.getCookie()); } return cookieList; }
public DefaultSavedRequest build() { DefaultSavedRequest savedRequest = new DefaultSavedRequest(this); if (!ObjectUtils.isEmpty(this.cookies)) { for (SavedCookie cookie : this.cookies) { savedRequest.addCookie(cookie.getCookie()); } } if (!ObjectUtils.isEmpty(this.locales)) savedRequest.locales.addAll(this.locales); savedRequest.addParameters(this.parameters); this.headers.remove(HEADER_IF_MODIFIED_SINCE); this.headers.remove(HEADER_IF_NONE_MATCH); for (Map.Entry<String, List<String>> entry : this.headers.entrySet()) { String headerName = entry.getKey(); List<String> headerValues = entry.getValue(); for (String headerValue : headerValues) { savedRequest.addHeader(headerName, headerValue); } } return savedRequest; } }