本文整理匯總了Java中org.eclipse.jetty.servlet.ServletContextHandler.setHandler方法的典型用法代碼示例。如果您正苦於以下問題:Java ServletContextHandler.setHandler方法的具體用法?Java ServletContextHandler.setHandler怎麽用?Java ServletContextHandler.setHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jetty.servlet.ServletContextHandler
的用法示例。
在下文中一共展示了ServletContextHandler.setHandler方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.eclipse.jetty.servlet.ServletContextHandler; //導入方法依賴的package包/類
@BeforeClass
public static void init() throws Exception {
Map<String, Object> map = new HashMap<>();
map.put("key", "value1");
map.put("num", 42);
JSON_RESPONSE = om.writeValueAsString(map);
server = new Server(7009);
ServletContextHandler servletContextHandler = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
servletContextHandler.setHandler(new EchoHandler());
server.start();
}
示例2: getServletContextHandler
import org.eclipse.jetty.servlet.ServletContextHandler; //導入方法依賴的package包/類
private static ServletContextHandler getServletContextHandler(AnnotationConfigWebApplicationContext context) throws IOException {
ServletContextHandler contextHandler = new ServletContextHandler();
WebConfigurer configurer = new WebConfigurer();
configurer.setContext(context);
contextHandler.addEventListener(configurer);
// Create the SessionHandler (wrapper) to handle the sessions
HashSessionManager manager = new HashSessionManager();
SessionHandler sessions = new SessionHandler(manager);
contextHandler.setHandler(sessions);
return contextHandler;
}
示例3: getServletContextHandler
import org.eclipse.jetty.servlet.ServletContextHandler; //導入方法依賴的package包/類
private static ServletContextHandler getServletContextHandler(AnnotationConfigWebApplicationContext context) throws IOException {
ServletContextHandler contextHandler = new ServletContextHandler();
JPAWebConfigurer configurer = new JPAWebConfigurer();
configurer.setContext(context);
contextHandler.addEventListener(configurer);
// Create the SessionHandler (wrapper) to handle the sessions
HashSessionManager manager = new HashSessionManager();
SessionHandler sessions = new SessionHandler(manager);
contextHandler.setHandler(sessions);
return contextHandler;
}