1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.esigate.http.cookie;
17
18 import org.apache.http.annotation.Contract;
19 import org.apache.http.annotation.ThreadingBehavior;
20 import org.apache.http.cookie.CookieSpec;
21 import org.apache.http.cookie.CookieSpecProvider;
22 import org.apache.http.impl.cookie.AbstractCookieSpec;
23 import org.apache.http.impl.cookie.BrowserCompatSpec;
24 import org.apache.http.impl.cookie.BrowserCompatSpecFactory.SecurityLevel;
25 import org.apache.http.protocol.HttpContext;
26
27
28
29
30
31
32 @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
33 public class CustomBrowserCompatSpecFactory implements CookieSpecProvider {
34
35
36
37
38 public static final String CUSTOM_BROWSER_COMPATIBILITY = "custom_browser_compatibility";
39
40 @Override
41 public CookieSpec create(final HttpContext context) {
42
43 AbstractCookieSpec cookieSpec = new BrowserCompatSpec(null, SecurityLevel.SECURITYLEVEL_IE_MEDIUM);
44 cookieSpec.registerAttribHandler(CookieUtil.HTTP_ONLY_ATTR, new HttpOnlyHandler());
45 return cookieSpec;
46 }
47
48 }