Skip to content

Commit 8d4239d

Browse files
committed
extracted cookie persistence methods and imported in the CookieJar
interface
1 parent 43ca9e6 commit 8d4239d

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

src/main/java/com/ning/http/client/cookiejar/AbstractCookieJar.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.ning.http.client.cookiejar;
22

3-
import java.util.Collection;
43
import java.util.Timer;
54

65
import com.ning.http.client.Cookie;
@@ -53,12 +52,6 @@ private void storeAndSchedule( String host, Cookie cookie )
5352
}
5453
}
5554

56-
protected abstract void persist( String host, Cookie cookie )
57-
throws Exception;
58-
59-
protected abstract Collection<Cookie> retrieve( String host )
60-
throws Exception;
61-
6255
final void delete( String host, Cookie cookie )
6356
throws Exception
6457
{
@@ -71,7 +64,4 @@ final void delete( String host, Cookie cookie )
7164
}
7265
}
7366

74-
protected abstract void remove( String host, Cookie cookie )
75-
throws Exception;
76-
7767
}

src/main/java/com/ning/http/client/cookiejar/CookieJar.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.ning.http.client.cookiejar;
22

3+
import java.util.Collection;
4+
5+
import com.ning.http.client.Cookie;
36
import com.ning.http.client.filter.RequestFilter;
47
import com.ning.http.client.filter.ResponseFilter;
58

@@ -10,4 +13,13 @@ public interface CookieJar
1013

1114
ResponseFilter getResponseFilter();
1215

16+
void persist( String host, Cookie cookie )
17+
throws Exception;
18+
19+
Collection<Cookie> retrieve( String host )
20+
throws Exception;
21+
22+
void remove( String host, Cookie cookie )
23+
throws Exception;
24+
1325
}

src/main/java/com/ning/http/client/cookiejar/InMemoryCookieJar.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ public final class InMemoryCookieJar
1717

1818
private final Lock lock = new ReentrantLock();
1919

20-
@Override
21-
protected void persist( String host, Cookie cookie )
20+
public void persist( String host, Cookie cookie )
2221
throws Exception
2322
{
2423
lock.lock();
@@ -41,8 +40,7 @@ protected void persist( String host, Cookie cookie )
4140
}
4241
}
4342

44-
@Override
45-
protected Collection<Cookie> retrieve( String host )
43+
public Collection<Cookie> retrieve( String host )
4644
throws Exception
4745
{
4846
lock.lock();
@@ -62,8 +60,7 @@ protected Collection<Cookie> retrieve( String host )
6260
}
6361
}
6462

65-
@Override
66-
protected void remove( String host, Cookie cookie )
63+
public void remove( String host, Cookie cookie )
6764
throws Exception
6865
{
6966
lock.lock();

0 commit comments

Comments
 (0)