001    package net.sf.tacos.seam;
002    
003    import java.io.IOException;
004    
005    import javax.servlet.ServletException;
006    import javax.servlet.http.HttpServletRequest;
007    import javax.servlet.http.HttpServletResponse;
008    
009    import org.apache.tapestry.ApplicationServlet;
010    import org.jboss.seam.servlet.ContextualHttpServletRequest;
011    
012    /**
013     * Wraps {@link ApplicationServlet} to setup Seam.
014     * 
015     * @author Igor Drobiazko
016     */
017    public class SeamApplicationServlet extends ApplicationServlet {
018    
019            private static final long serialVersionUID = -7652527657043832752L;
020    
021            @Override
022            protected void doService(final HttpServletRequest request,
023                            final HttpServletResponse response) throws IOException, ServletException {
024                    new ContextualHttpServletRequest( (HttpServletRequest) request ){
025                            @Override
026                            public void process() throws ServletException, IOException{
027                                    SeamApplicationServlet.this.superDoService(request, response);
028                            }
029                    }.run();
030            }
031            
032            protected void superDoService(final HttpServletRequest request,
033                            final HttpServletResponse response) throws IOException, ServletException {
034                    super.doService(request, response);
035            }
036    
037    }