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.MalformedCookieException;
21 import org.apache.http.cookie.SetCookie;
22 import org.apache.http.impl.cookie.AbstractCookieAttributeHandler;
23 import org.apache.http.impl.cookie.BasicClientCookie;
24 import org.apache.http.util.Args;
25
26
27
28
29
30
31 @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
32 public class HttpOnlyHandler extends AbstractCookieAttributeHandler {
33
34 public HttpOnlyHandler() {
35 super();
36 }
37
38 public void parse(final SetCookie cookie, final String value) throws MalformedCookieException {
39
40 Args.notNull(cookie, "Cookie");
41 ((BasicClientCookie) cookie).setAttribute(CookieUtil.HTTP_ONLY_ATTR, "");
42
43 }
44
45 }