Skip to content

Revert cookie store implementation #1566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import io.netty.util.Timer;
import org.asynchttpclient.channel.ChannelPool;
import org.asynchttpclient.channel.KeepAliveStrategy;
import org.asynchttpclient.cookie.CookieStore;
import org.asynchttpclient.filter.IOExceptionFilter;
import org.asynchttpclient.filter.RequestFilter;
import org.asynchttpclient.filter.ResponseFilter;
Expand Down Expand Up @@ -183,13 +182,6 @@ public interface AsyncHttpClientConfig {
*/
List<IOExceptionFilter> getIoExceptionFilters();

/**
* Return cookie store that is used to store and retrieve cookies
*
* @return {@link CookieStore} object
*/
CookieStore getCookieStore();

/**
* Return the number of time the library will retry when an {@link java.io.IOException} is throw by the remote server
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.asynchttpclient;

import io.netty.channel.EventLoopGroup;
import io.netty.handler.codec.http.cookie.Cookie;
import io.netty.util.HashedWheelTimer;
import io.netty.util.Timer;
import io.netty.util.concurrent.DefaultThreadFactory;
Expand All @@ -31,7 +30,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Predicate;
Expand Down Expand Up @@ -190,22 +188,6 @@ public BoundRequestBuilder prepareRequest(RequestBuilder requestBuilder) {

@Override
public <T> ListenableFuture<T> executeRequest(Request request, AsyncHandler<T> handler) {
if (config.getCookieStore() != null) {
try {
List<Cookie> cookies = config.getCookieStore().get(request.getUri());
if (!cookies.isEmpty()) {
RequestBuilder requestBuilder = new RequestBuilder(request);
for (Cookie cookie : cookies) {
requestBuilder.addOrReplaceCookie(cookie);
}
request = requestBuilder.build();
}
} catch (Exception e) {
handler.onThrowable(e);
return new ListenableFuture.CompletedFailure<>("Failed to set cookies of request", e);
}
}

if (noRequestFilters) {
return execute(request, handler);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import org.asynchttpclient.channel.DefaultKeepAliveStrategy;
import org.asynchttpclient.channel.KeepAliveStrategy;
import org.asynchttpclient.config.AsyncHttpClientConfigDefaults;
import org.asynchttpclient.cookie.CookieStore;
import org.asynchttpclient.cookie.ThreadSafeCookieStore;
import org.asynchttpclient.filter.IOExceptionFilter;
import org.asynchttpclient.filter.RequestFilter;
import org.asynchttpclient.filter.ResponseFilter;
Expand Down Expand Up @@ -106,9 +104,6 @@ public class DefaultAsyncHttpClientConfig implements AsyncHttpClientConfig {
private final List<ResponseFilter> responseFilters;
private final List<IOExceptionFilter> ioExceptionFilters;

// cookie store
private final CookieStore cookieStore;

// internals
private final String threadPoolName;
private final int httpClientCodecMaxInitialLineLength;
Expand Down Expand Up @@ -185,9 +180,6 @@ private DefaultAsyncHttpClientConfig(// http
List<ResponseFilter> responseFilters,
List<IOExceptionFilter> ioExceptionFilters,

// cookie store
CookieStore cookieStore,

// tuning
boolean tcpNoDelay,
boolean soReuseAddress,
Expand Down Expand Up @@ -272,9 +264,6 @@ private DefaultAsyncHttpClientConfig(// http
this.responseFilters = responseFilters;
this.ioExceptionFilters = ioExceptionFilters;

// cookie store
this.cookieStore = cookieStore;

// tuning
this.tcpNoDelay = tcpNoDelay;
this.soReuseAddress = soReuseAddress;
Expand Down Expand Up @@ -537,12 +526,6 @@ public List<IOExceptionFilter> getIoExceptionFilters() {
return ioExceptionFilters;
}

// cookie store
@Override
public CookieStore getCookieStore() {
return cookieStore;
}

// tuning
@Override
public boolean isTcpNoDelay() {
Expand Down Expand Up @@ -713,9 +696,6 @@ public static class Builder {
private SslContext sslContext;
private SslEngineFactory sslEngineFactory;

// cookie store
private CookieStore cookieStore = new ThreadSafeCookieStore();

// tuning
private boolean tcpNoDelay = defaultTcpNoDelay();
private boolean soReuseAddress = defaultSoReuseAddress();
Expand Down Expand Up @@ -1092,12 +1072,6 @@ public Builder removeIOExceptionFilter(IOExceptionFilter ioExceptionFilter) {
return this;
}

// cookie store
public Builder setCookieStore(CookieStore cookieStore) {
this.cookieStore = cookieStore;
return this;
}

// tuning
public Builder setTcpNoDelay(boolean tcpNoDelay) {
this.tcpNoDelay = tcpNoDelay;
Expand Down Expand Up @@ -1265,7 +1239,6 @@ public DefaultAsyncHttpClientConfig build() {
requestFilters.isEmpty() ? Collections.emptyList() : Collections.unmodifiableList(requestFilters),
responseFilters.isEmpty() ? Collections.emptyList() : Collections.unmodifiableList(responseFilters),
ioExceptionFilters.isEmpty() ? Collections.emptyList() : Collections.unmodifiableList(ioExceptionFilters),
cookieStore,
tcpNoDelay,
soReuseAddress,
soLinger,
Expand Down
85 changes: 0 additions & 85 deletions client/src/main/java/org/asynchttpclient/cookie/CookieStore.java

This file was deleted.

Loading