1 16 package org.directwebremoting.impl; 17 18 import javax.servlet.ServletConfig ; 19 import javax.servlet.ServletContext ; 20 21 import org.directwebremoting.Container; 22 import org.directwebremoting.ServerContext; 23 import org.directwebremoting.ServerContextFactory.ServerContextBuilder; 24 import org.directwebremoting.util.Logger; 25 26 30 public class DefaultServerContextBuilder implements ServerContextBuilder 31 { 32 35 public void set(ServletConfig config, ServletContext context, Container container) 36 { 37 try 38 { 39 ServerContext ec = new DefaultServerContext(config, context, container); 40 context.setAttribute(ATTRIBUTE_SERVER_CONTEXT, ec); 41 } 42 catch (Exception ex) 43 { 44 log.fatal("Failed to create an ExecutionContext", ex); 45 } 46 } 47 48 51 public ServerContext get(ServletContext context) 52 { 53 return (ServerContext) context.getAttribute(ATTRIBUTE_SERVER_CONTEXT); 54 } 55 56 59 private static final String ATTRIBUTE_SERVER_CONTEXT = "org.directwebremoting.impl.ServerContext"; 60 61 64 private static final Logger log = Logger.getLogger(DefaultServerContextBuilder.class); 65 } 66 | Popular Tags |