@ Override public void init ( final FilterConfig _filterConfig ) throws ServletException { super . init ( _filterConfig ) ; final String root = "/" + _filterConfig . getServletContext ( ) . getServletContextName ( ) + "/" ; this . notLoggedInForward = "/" + _filterConfig . getInitParameter ( TransactionFilter . INIT_PARAM_URL_LOGIN_PAGE ) ; if ( this . notLoggedInForward == null || this . notLoggedInForward . length ( ) == 0 ) { throw new ServletException ( "Init parameter " + "'" + TransactionFilter . INIT_PARAM_URL_LOGIN_PAGE + "' not defined" ) ; } this . exludeUris . add ( ( root + this . notLoggedInForward ) . replaceAll ( "//+" , "/" ) ) ; this . exludeUris . add ( ( root + "/servlet/login" ) . replaceAll ( "//+" , "/" ) ) ; final ServiceLoader < ILoginProvider > serviceLoaderLogins = ServiceLoader . load ( ILoginProvider . class ) ; for ( final ILoginProvider loginProvider : serviceLoaderLogins ) { LOG . info ( "[TransactionFilter] registered: {}" , loginProvider ) ; this . loginProviders . add ( loginProvider ) ; } }
Called by the web container to indicate to a filter that it is being placed into service . The servlet container calls the init method exactly once after instantiating the filter . The init method must complete successfully before the filter is asked to do any filtering work . The web container cannot place the filter into service if the init method either