View Javadoc

1   /*
2    * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/IgnoreCookiesSpec.java,v 1.5 2004/05/13 04:02:00 mbecke Exp $
3    * $Revision: 1.5 $
4    * $Date: 2004/05/13 04:02:00 $
5    *
6    * ====================================================================
7    *
8    *  Copyright 2002-2004 The Apache Software Foundation
9    *
10   *  Licensed under the Apache License, Version 2.0 (the "License");
11   *  you may not use this file except in compliance with the License.
12   *  You may obtain a copy of the License at
13   *
14   *      http://www.apache.org/licenses/LICENSE-2.0
15   *
16   *  Unless required by applicable law or agreed to in writing, software
17   *  distributed under the License is distributed on an "AS IS" BASIS,
18   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   *  See the License for the specific language governing permissions and
20   *  limitations under the License.
21   * ====================================================================
22   *
23   * This software consists of voluntary contributions made by many
24   * individuals on behalf of the Apache Software Foundation.  For more
25   * information on the Apache Software Foundation, please see
26   * <http://www.apache.org/>.
27   *
28   */ 
29  
30  package org.apache.commons.httpclient.cookie;
31  
32  import org.apache.commons.httpclient.Cookie;
33  import org.apache.commons.httpclient.Header;
34  import org.apache.commons.httpclient.NameValuePair;
35  
36  /***
37   * A cookie spec that does nothing.  Cookies are neither parsed, formatted nor matched.
38   * 
39   * @since 3.0
40   */
41  public class IgnoreCookiesSpec implements CookieSpec {
42  
43      /***
44       * 
45       */
46      public IgnoreCookiesSpec() {
47          super();
48      }
49  
50      /***
51       * Returns an empty {@link Cookie cookie} array.  All parameters are ignored.
52       */
53      public Cookie[] parse(String host, int port, String path, boolean secure, String header)
54          throws MalformedCookieException {
55          return new Cookie[0];
56      }
57  
58      /***
59       * @return <code>null</code>
60       */
61      public String formatCookie(Cookie cookie) {
62          return null;
63      }
64  
65      /***
66       * @return <code>null</code>
67       */
68      public Header formatCookieHeader(Cookie cookie) throws IllegalArgumentException {
69          return null;
70      }
71  
72      /***
73       * @return <code>null</code>
74       */
75      public Header formatCookieHeader(Cookie[] cookies) throws IllegalArgumentException {
76          return null;
77      }
78  
79      /***
80       * @return <code>null</code>
81       */
82      public String formatCookies(Cookie[] cookies) throws IllegalArgumentException {
83          return null;
84      }
85  
86      /***
87       * @return <code>false</code>
88       */
89      public boolean match(String host, int port, String path, boolean secure, Cookie cookie) {
90          return false;
91      }
92  
93      /***
94       * Returns an empty {@link Cookie cookie} array.  All parameters are ignored.
95       */
96      public Cookie[] match(String host, int port, String path, boolean secure, Cookie[] cookies) {
97          return new Cookie[0];
98      }
99  
100     /***
101      * Returns an empty {@link Cookie cookie} array.  All parameters are ignored.
102      */
103     public Cookie[] parse(String host, int port, String path, boolean secure, Header header)
104         throws MalformedCookieException, IllegalArgumentException {
105         return new Cookie[0];
106     }
107 
108     /***
109      * Does nothing.
110      */
111     public void parseAttribute(NameValuePair attribute, Cookie cookie)
112         throws MalformedCookieException, IllegalArgumentException {
113     }
114 
115     /***
116      * Does nothing.
117      */
118     public void validate(String host, int port, String path, boolean secure, Cookie cookie)
119         throws MalformedCookieException, IllegalArgumentException {
120     }
121 
122     /***
123      * @return <code>false</code>
124      */
125     public boolean domainMatch(final String host, final String domain) {
126         return false;
127     }
128 
129     /***
130      * @return <code>false</code>
131      */
132     public boolean pathMatch(final String path, final String topmostPath) {
133         return false;
134     }
135 
136 }