xiaodududu / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Filters/Servlets should only be initialized once #335

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
...even if they appear multiple times in the filter chain.

Reported by Rex on the mailing list:
Sorry, my fault. ServletContainer is also a filter. 

My usage: 
new ServletModule() {
                    @Override
                    protected void configureServlets() {
                        Map<String, String> initParams = Maps.newHashMap();
                        initParams.put("com.sun.jersey.config.property.packages", 
Home.class.getPackage().getName());
                        filterRegex("/(home|logout|login.*)").through(JerseyFilter.class, initParams);
                    }
                },

If I announce filterRegex("/home", "/logout", "/login.*"), the @Singleton 
JerseyFilter will initiate() 3 
times. It this normal?

Thanks,
Rex

Original issue reported on code.google.com by dha...@gmail.com on 14 Feb 2009 at 9:07

GoogleCodeExporter commented 9 years ago
Fix in rev 846:
http://code.google.com/p/google-guice/source/detail?r=846

Needs verification. Plz report more issues here.

Original comment by dha...@gmail.com on 14 Feb 2009 at 10:36