package org.seasar.hibernate.filter;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import org.seasar.framework.container.S2Container;
import org.seasar.framework.container.factory.SingletonS2ContainerFactory;

public class OpenSessionInViewFilter implements Filter {

	public void doFilter(
		ServletRequest request,
		ServletResponse response,
		FilterChain chain)
		throws IOException, ServletException {

		S2Container container = SingletonS2ContainerFactory.getContainer();

		FilterChainTx chainProxy =
			(FilterChainTx) container.getComponent(FilterChainTx.class);

		chainProxy.doFilter(request, response, chain);

	}

	public void init(FilterConfig filterConfig) throws ServletException {
	}

	public void destroy() {
	}

}
