    1   /***
    2    * JFoxSOAF, Service-Oriented Application Framework
    3    *
    4    * Copyright (C) www.huihoo.org
    5    *
    6    * Distributable under GNU LGPL For more information, please visit:
    7    * http://www.huihoo.org/jfox/jfoxsoaf
    8    */
    9
    10  package org.huihoo.jfox.soaf.util.filter;
    11
    12  import java.util.Enumeration;
    13
    14  import javax.servlet.FilterConfig;
    15  import javax.servlet.ServletContext;
    16
    17  /***
    18   * Mock FilterConfig
    19   *
    20   * @author <a href="mailto:founder_chen@yahoo.com">Peter Cheng </a>
    21   * @version $Revision: 1.1 $ $Date: 2004/10/25 11:25:48 $
    22   * @version Revision: 1.0
    23   */
    24
    25  public class MockFilterConfig implements FilterConfig {
    26
    27      private String encoding;
    28
    29      private String ignore;
    30
    31      /***
    32       * @see javax.servlet.FilterConfig#getFilterName()
    33       */
    34      public String getFilterName() {
    35          return "characterEncodingFilter";
    36      }
    37
    38      /***
    39       * @see javax.servlet.FilterConfig#getServletContext()
    40       */
    41      public ServletContext getServletContext() {
    42          return null;
    43      }
    44
    45      /***
    46       * @see javax.servlet.FilterConfig#getInitParameter(java.lang.String)
    47       */
    48      public String getInitParameter(String param) {
    49          if (param.equalsIgnoreCase("encoding")) {
    50              return this.encoding;
    51          } else {
    52              if (param.equalsIgnoreCase("ignore")) {
    53                  return this.ignore;
    54              } else {
    55                  return null;
    56              }
    57          }
    58
    59      }
    60
    61      /***
    62       * @see javax.servlet.FilterConfig#getInitParameterNames()
    63       */
    64      public Enumeration getInitParameterNames() {
    65          return null;
    66      }
    67
    68      /***
    69       * @param encoding
    70       *            The encoding to set.
    71       */
    72      public void setEncoding(String encoding) {
    73          this.encoding = encoding;
    74      }
    75
    76      /***
    77       * @param ignore
    78       *            The ignore to set.
    79       */
    80      public void setIgnore(String ignore) {
    81          this.ignore = ignore;
    82      }
    83  }