1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package org.apache.commons.httpclient.cookie;
31
32 import java.util.Collection;
33
34 import org.apache.commons.httpclient.Cookie;
35 import org.apache.commons.httpclient.Header;
36 import org.apache.commons.httpclient.NameValuePair;
37
38 /***
39 * A cookie spec that does nothing. Cookies are neither parsed, formatted nor matched.
40 * It can be used to effectively disable cookies altogether.
41 *
42 * @since 3.0
43 */
44 public class IgnoreCookiesSpec implements CookieSpec {
45
46 /***
47 *
48 */
49 public IgnoreCookiesSpec() {
50 super();
51 }
52
53 /***
54 * Returns an empty {@link Cookie cookie} array. All parameters are ignored.
55 */
56 public Cookie[] parse(String host, int port, String path, boolean secure, String header)
57 throws MalformedCookieException {
58 return new Cookie[0];
59 }
60
61 /***
62 * @return <code>null</code>
63 */
64 public Collection getValidDateFormats() {
65 return null;
66 }
67
68 /***
69 * Does nothing.
70 */
71 public void setValidDateFormats(Collection datepatterns) {
72 }
73
74 /***
75 * @return <code>null</code>
76 */
77 public String formatCookie(Cookie cookie) {
78 return null;
79 }
80
81 /***
82 * @return <code>null</code>
83 */
84 public Header formatCookieHeader(Cookie cookie) throws IllegalArgumentException {
85 return null;
86 }
87
88 /***
89 * @return <code>null</code>
90 */
91 public Header formatCookieHeader(Cookie[] cookies) throws IllegalArgumentException {
92 return null;
93 }
94
95 /***
96 * @return <code>null</code>
97 */
98 public String formatCookies(Cookie[] cookies) throws IllegalArgumentException {
99 return null;
100 }
101
102 /***
103 * @return <code>false</code>
104 */
105 public boolean match(String host, int port, String path, boolean secure, Cookie cookie) {
106 return false;
107 }
108
109 /***
110 * Returns an empty {@link Cookie cookie} array. All parameters are ignored.
111 */
112 public Cookie[] match(String host, int port, String path, boolean secure, Cookie[] cookies) {
113 return new Cookie[0];
114 }
115
116 /***
117 * Returns an empty {@link Cookie cookie} array. All parameters are ignored.
118 */
119 public Cookie[] parse(String host, int port, String path, boolean secure, Header header)
120 throws MalformedCookieException, IllegalArgumentException {
121 return new Cookie[0];
122 }
123
124 /***
125 * Does nothing.
126 */
127 public void parseAttribute(NameValuePair attribute, Cookie cookie)
128 throws MalformedCookieException, IllegalArgumentException {
129 }
130
131 /***
132 * Does nothing.
133 */
134 public void validate(String host, int port, String path, boolean secure, Cookie cookie)
135 throws MalformedCookieException, IllegalArgumentException {
136 }
137
138 /***
139 * @return <code>false</code>
140 */
141 public boolean domainMatch(final String host, final String domain) {
142 return false;
143 }
144
145 /***
146 * @return <code>false</code>
147 */
148 public boolean pathMatch(final String path, final String topmostPath) {
149 return false;
150 }
151
152 }