package de.dhbw.humbuch.guice;

import javax.servlet.FilterConfig;
import javax.servlet.ServletException;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceFilter;

import de.davherrmann.guice.vaadin.UIScopeModule;

public class BasicFilter extends GuiceFilter {

	private static Injector INJECTOR;

	public static Injector getInjector() {
		return INJECTOR;
	}

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		if (INJECTOR != null) {
			throw new ServletException("Injector already created?!");
		}
		INJECTOR = Guice.createInjector(new BasicModule(), new UIScopeModule());
		filterConfig.getServletContext().log(
				"Created injector with " + INJECTOR.getAllBindings().size()
						+ " bindings.");
		super.init(filterConfig);
	}
}

@@ -23,24 +23,54 @@
 h.guice;%0D%0A%0D%0A
+import javax.servlet.Filter;%0D%0A
 import javax
@@ -306,16 +306,111 @@
 ule;%0D%0A%0D%0A
+/**%0D%0A * @author davherrmann%0D%0A *%0D%0A * %7B@link Filter%7D for creating a Guice %7B@link Injector%7D%0D%0A */%0D%0A
 public c

add javadoc information