1 16 package org.directwebremoting.impl; 17 18 import javax.servlet.ServletConfig ; 19 import javax.servlet.ServletContext ; 20 import javax.servlet.http.HttpServletRequest ; 21 import javax.servlet.http.HttpServletResponse ; 22 23 import org.directwebremoting.Container; 24 import org.directwebremoting.WebContext; 25 import org.directwebremoting.WebContextFactory.WebContextBuilder; 26 import org.directwebremoting.util.Logger; 27 28 32 public class DefaultWebContextBuilder implements WebContextBuilder 33 { 34 37 public void set(HttpServletRequest request, HttpServletResponse response, ServletConfig config, ServletContext context, Container container) 38 { 39 try 40 { 41 WebContext ec = new DefaultWebContext(request, response, config, context, container); 42 user.set(ec); 43 } 44 catch (Exception ex) 45 { 46 log.fatal("Failed to create an ExecutionContext", ex); 47 } 48 } 49 50 53 public WebContext get() 54 { 55 return (WebContext) user.get(); 56 } 57 58 61 public void unset() 62 { 63 user.set(null); 64 } 65 66 69 private static ThreadLocal user = new ThreadLocal (); 70 71 74 private static final Logger log = Logger.getLogger(DefaultWebContextBuilder.class); 75 } 76 | Popular Tags |