Search in sources :

Example 1 with BasicClientCookie

use of org.apache.hc.client5.http.impl.cookie.BasicClientCookie in project spring-framework by spring-projects.

the class HttpComponentsClientHttpRequest method applyCookies.

@Override
protected void applyCookies() {
    if (getCookies().isEmpty()) {
        return;
    }
    CookieStore cookieStore = this.context.getCookieStore();
    getCookies().values().stream().flatMap(Collection::stream).forEach(cookie -> {
        BasicClientCookie clientCookie = new BasicClientCookie(cookie.getName(), cookie.getValue());
        clientCookie.setDomain(getURI().getHost());
        clientCookie.setPath(getURI().getPath());
        cookieStore.addCookie(clientCookie);
    });
}
Also used : CookieStore(org.apache.hc.client5.http.cookie.CookieStore) BasicClientCookie(org.apache.hc.client5.http.impl.cookie.BasicClientCookie)

Aggregations

CookieStore (org.apache.hc.client5.http.cookie.CookieStore)1 BasicClientCookie (org.apache.hc.client5.http.impl.cookie.BasicClientCookie)1