本文整理汇总了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;
}