예제 #1
0
  /* ------------------------------------------------------------ */
  @Override
  public void doStart() throws Exception {
    super.doStart();

    if (!javax.servlet.Filter.class.isAssignableFrom(_class)) {
      String msg = _class + " is not a javax.servlet.Filter";
      super.stop();
      throw new IllegalStateException(msg);
    }
  }
예제 #2
0
 /* ------------------------------------------------------------ */
 @Override
 public void dump(Appendable out, String indent) throws IOException {
   super.dump(out, indent);
   if (_filter instanceof Dumpable) {
     ((Dumpable) _filter).dump(out, indent);
   }
 }
예제 #3
0
  /* ------------------------------------------------------------ */
  @Override
  public void doStop() throws Exception {
    if (_filter != null) {
      try {
        destroyInstance(_filter);
      } catch (Exception e) {
        LOG.warn(e);
      }
    }
    if (!_extInstance) _filter = null;

    _config = null;
    super.doStop();
  }
예제 #4
0
  /* ------------------------------------------------------------ */
  @Override
  public void initialize() throws Exception {
    super.initialize();

    if (_filter == null) {
      try {
        ServletContext context = _servletHandler.getServletContext();
        _filter =
            (context instanceof ServletContextHandler.Context)
                ? ((ServletContextHandler.Context) context).createFilter(getHeldClass())
                : getHeldClass().newInstance();
      } catch (ServletException se) {
        Throwable cause = se.getRootCause();
        if (cause instanceof InstantiationException) throw (InstantiationException) cause;
        if (cause instanceof IllegalAccessException) throw (IllegalAccessException) cause;
        throw se;
      }
    }

    _config = new Config();
    if (LOG.isDebugEnabled()) LOG.debug("Filter.init {}", _filter);
    _filter.init(_config);
  }