1. /*
  2. * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/IgnoreCookiesSpec.java,v 1.6 2004/09/14 20:11:31 olegk Exp $
  3. * $Revision: 1.6 $
  4. * $Date: 2004/09/14 20:11:31 $
  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. package org.apache.commons.httpclient.cookie;
  30. import java.util.Collection;
  31. import org.apache.commons.httpclient.Cookie;
  32. import org.apache.commons.httpclient.Header;
  33. import org.apache.commons.httpclient.NameValuePair;
  34. /**
  35. * A cookie spec that does nothing. Cookies are neither parsed, formatted nor matched.
  36. *
  37. * @since 3.0
  38. */
  39. public class IgnoreCookiesSpec implements CookieSpec {
  40. /**
  41. *
  42. */
  43. public IgnoreCookiesSpec() {
  44. super();
  45. }
  46. /**
  47. * Returns an empty {@link Cookie cookie} array. All parameters are ignored.
  48. */
  49. public Cookie[] parse(String host, int port, String path, boolean secure, String header)
  50. throws MalformedCookieException {
  51. return new Cookie[0];
  52. }
  53. /**
  54. * @return <code>null</code>
  55. */
  56. public Collection getValidDateFormats() {
  57. return null;
  58. }
  59. /**
  60. * Does nothing.
  61. */
  62. public void setValidDateFormats(Collection datepatterns) {
  63. }
  64. /**
  65. * @return <code>null</code>
  66. */
  67. public String formatCookie(Cookie cookie) {
  68. return null;
  69. }
  70. /**
  71. * @return <code>null</code>
  72. */
  73. public Header formatCookieHeader(Cookie cookie) throws IllegalArgumentException {
  74. return null;
  75. }
  76. /**
  77. * @return <code>null</code>
  78. */
  79. public Header formatCookieHeader(Cookie[] cookies) throws IllegalArgumentException {
  80. return null;
  81. }
  82. /**
  83. * @return <code>null</code>
  84. */
  85. public String formatCookies(Cookie[] cookies) throws IllegalArgumentException {
  86. return null;
  87. }
  88. /**
  89. * @return <code>false</code>
  90. */
  91. public boolean match(String host, int port, String path, boolean secure, Cookie cookie) {
  92. return false;
  93. }
  94. /**
  95. * Returns an empty {@link Cookie cookie} array. All parameters are ignored.
  96. */
  97. public Cookie[] match(String host, int port, String path, boolean secure, Cookie[] cookies) {
  98. return new Cookie[0];
  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. * Does nothing.
  109. */
  110. public void parseAttribute(NameValuePair attribute, Cookie cookie)
  111. throws MalformedCookieException, IllegalArgumentException {
  112. }
  113. /**
  114. * Does nothing.
  115. */
  116. public void validate(String host, int port, String path, boolean secure, Cookie cookie)
  117. throws MalformedCookieException, IllegalArgumentException {
  118. }
  119. /**
  120. * @return <code>false</code>
  121. */
  122. public boolean domainMatch(final String host, final String domain) {
  123. return false;
  124. }
  125. /**
  126. * @return <code>false</code>
  127. */
  128. public boolean pathMatch(final String path, final String topmostPath) {
  129. return false;
  130. }
  131. }