Differences between revisions 1 and 2
Revision 1 as of 2005-09-26 12:11:04
Size: 1578
Comment:
Revision 2 as of 2009-09-20 22:01:28
Size: 1578
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

package scm.hivemind.statefulservice;

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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.hivemind.Registry;
import org.apache.hivemind.servlet.HiveMindFilter;


/**
 * A servlet filter for setting up the 
 * {@link scm.hivemind.statefulservice.ClientStateStorage}
 * for services holding state across requests.
 * 
 * @author Marcus Schulte
 */
public class StatefulHivemindFilter implements Filter {

        /**
         * 
         */
        public StatefulHivemindFilter() {
                super();
        }
   

        public void doFilter(ServletRequest request, ServletResponse response,
                        FilterChain chain) throws IOException, ServletException {
                
                HttpServletRequest req = (HttpServletRequest) request;
                Registry registry = HiveMindFilter.getRegistry( req );
                ClientStateStorage stateStore = (ClientStateStorage) 
                                       registry.getService(ClientStateStorage.class);
                stateStore.provideSession( req.getSession() );
                chain.doFilter( request, response );
                
        }
        
        /* (non-Javadoc)
         * @see javax.servlet.Filter#destroy()
         */
        public void destroy() {
                        }
        /* (non-Javadoc)
         * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
         */
        public void init(FilterConfig filterConfig) throws ServletException {
        }
}

StatefulHivemindFilter (last edited 2009-09-20 22:01:28 by localhost)