1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.esigate.http;
17
18 import java.util.Date;
19 import java.util.List;
20
21 import org.apache.http.client.CookieStore;
22 import org.apache.http.cookie.Cookie;
23 import org.esigate.cookie.CookieManager;
24 import org.esigate.impl.DriverRequest;
25
26
27
28
29
30
31
32
33
34
35 public class RequestCookieStore implements CookieStore {
36
37 private final DriverRequest originalRequest;
38 private final CookieManager cookieManager;
39
40 public RequestCookieStore(CookieManager cookieManager, DriverRequest originalRequest) {
41 this.originalRequest = originalRequest;
42 this.cookieManager = cookieManager;
43 }
44
45 @Override
46 public void addCookie(Cookie cookie) {
47 this.cookieManager.addCookie(cookie, this.originalRequest);
48 }
49
50 @Override
51 public List<Cookie> getCookies() {
52 return this.cookieManager.getCookies(this.originalRequest);
53 }
54
55 @Override
56 public boolean clearExpired(Date date) {
57 return this.cookieManager.clearExpired(date, this.originalRequest);
58 }
59
60 @Override
61 public void clear() {
62 this.cookieManager.clear(this.originalRequest);
63 }
64
65 }