I am feeling kinda dumb here.  I have a Filter that works fine except it
does not call init() the first time it is put into service.  I tried wiping
out the persistence files in orion/application-deployment and
orion/persistence but it does not seem to ever call the Filter's init
method.  I am using JDK 1.3.1_03 and Orion 1.5.4.

Any ideas?

Here is what the souce looks like:

package com.we.servlet;

import javax.servlet.*;
import javax.servlet.http.*;

public class MyFilter implements Filter {

  private static final boolean DEBUG = true;
  private static final int DEFAULT_MAX_POST_SIZE = 1024 * 1024 * 5;  // 5
Meg
  private int postSize = DEFAULT_MAX_POST_SIZE;
  private FilterConfig config = null;

  public void init(FilterConfig config) throws ServletException
  {
    this.config = config;
    String newSize = config.getInitParameter("postSize");
    if(newSize != null && newSize.trim().length() > 0)
    {
      try
      {
        postSize = Integer.parseInt(newSize.trim());
      }
      catch(Exception e)
      {
        throw new ServletException(e.getMessage());
      } 
      System.out.println("MyFilter.init() post size is now:" + postSize);
    }

    System.out.println("MyFilter initialized with post limit of " +
postSize);
  }

  public void destroy() {
    config = null;
  }

  public void doFilter(ServletRequest request, ServletResponse response,
                     FilterChain chain) throws IOException, ServletException
  {
    if(DEBUG)
      System.out.println("Post Size:" + postSize);
 
    chain.doFilter(multi, response);
  }

  public void setFilterConfig(FilterConfig config)
  {
    this.config = config;
  }

  public FilterConfig getFilterConfig()
  {
    return this.config;
  }
}

Reply via email to