当前位置: 首页>>代码示例>>Java>>正文


Java ServletContextHandler.addEventListener方法代码示例

本文整理汇总了Java中org.eclipse.jetty.servlet.ServletContextHandler.addEventListener方法的典型用法代码示例。如果您正苦于以下问题:Java ServletContextHandler.addEventListener方法的具体用法?Java ServletContextHandler.addEventListener怎么用?Java ServletContextHandler.addEventListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jetty.servlet.ServletContextHandler的用法示例。


在下文中一共展示了ServletContextHandler.addEventListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startComponent

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
@Override
public void startComponent() {
  // Initialize servlet using RESTEasy and it's Guice bridge.
  // The listener must be injected by the same Guice module which also binds the REST endpoints.
  ServletContextHandler servletHandler = new ServletContextHandler();
  servletHandler.addEventListener(listener);
  servletHandler.addServlet(HttpServletDispatcher.class, "/*");

  // Starting up Jetty to serve the REST API.
  server = new Server(port);
  server.setHandler(servletHandler);

  try {
    server.start();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:19,代码来源:ApiServer.java

示例2: ParticipantHoster

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public ParticipantHoster(final List<ContextParticipantProxy> unregisteredParticipants, final short port) throws Exception {
	participants = unregisteredParticipants;

	participantsUrl = FluentIterable.from(participants).transform(new Function<ContextParticipantProxy, String>() {

		@Override
		public String apply(final ContextParticipantProxy input) {
			// return "/" + input.getApplicationName() +
			// "/ContextParticipant/*";
			return input.getApplicationName();
		}
	}).append("/*");

	server = new Server(port);
	final ServletContextHandler sch = new ServletContextHandler(server, "/");
	sch.addEventListener(new InnerListener());
	sch.addFilter(AppGuiceFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
	sch.addServlet(DefaultServlet.class, "/");
	server.start();
}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:21,代码来源:ParticipantHoster.java

示例3: beforeClass

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	ccowServer = new Server(serverPort);

	final CCOWContextListener c = new CCOWContextListener(commonContext, new InlinedContextAgentRepositoryModule());

	final MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
	ccowServer.addBean(mbContainer);

	final ServletContextHandler webSocketServletContextHandler = new ServletContextHandler(ccowServer, "/ws",
			ServletContextHandler.SESSIONS);
	webSocketServletContextHandler.addEventListener(c);
	WebSocketServerContainerInitializer.configureContext(webSocketServletContextHandler);

	final ServletContextHandler restServletContextHandler = new ServletContextHandler(ccowServer, "/");
	restServletContextHandler.addEventListener(c);
	restServletContextHandler.addFilter(AppGuiceFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));

	 final ContextHandlerCollection contexts = new ContextHandlerCollection();
        contexts.setHandlers(new Handler[] { webSocketServletContextHandler, restServletContextHandler});
        
	ccowServer.setHandler(contexts);
	ccowServer.start();

}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:26,代码来源:WebSocketsTestSuite.java

示例4: main

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  Injector injector = Guice.createInjector(getModules(args));
  
  Server server = new Server(injector.getInstance(Key.get(Integer.class, Port.class)));
  ServletContextHandler handler = new ServletContextHandler(server, "/pvwatts");
  
  handler.addEventListener(injector.getInstance(
    GuiceResteasyBootstrapServletContextListener.class));

  ServletHolder sh = new ServletHolder(HttpServletDispatcher.class);
  handler.addServlet(sh, "/*");
  server.setHandler(handler);

  server.start();
  server.join();
}
 
开发者ID:spharris,项目名称:pvwatts-java,代码行数:17,代码来源:PvWattsServer.java

示例5: HelloMain

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public HelloMain(int port) {
  this.port = port;

  context = new ServletContextHandler();
  context.setContextPath("/");

  // Use Weld to inject into servlets
  context.addEventListener(new org.jboss.weld.environment.servlet.Listener());

  jettyServer = new Server(port);
  jettyServer.setHandler(context);

  addJaxRsApplication(HelloApplication.class);
  start();
}
 
开发者ID:chonton,项目名称:apm-client,代码行数:16,代码来源:HelloMain.java

示例6: init

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
/**
 * Method used to initialize and start the SSE server
 */
public static void init()
{
	Server server = new Server();
	SelectChannelConnector connector = new SelectChannelConnector();
	connector.setPort(8070);
	connector.setAcceptors(3);
	connector.setThreadPool(new QueuedThreadPool(50));
	connector.setMaxIdleTime(72*60*60*1000);
	connector.setAcceptQueueSize(50000);
	connector.setRequestBufferSize(50000);
	connector.setResponseBufferSize(50000);
	server.setConnectors(new Connector[] { connector });
	ServletContextHandler context = new ServletContextHandler(
			ServletContextHandler.SESSIONS);
	context.setContextPath("/");
	//context.setResourceBase(System.getProperty("java.io.tmpdir"));

	ServletHolder requestServletHolder = new ServletHolder(EventServer.class);
	context.addServlet(requestServletHolder, "/response");

	ServletHolder notificationServletHolder = new ServletHolder(NotificationServer.class);
	context.addServlet(notificationServletHolder, "/notification");


	server.setHandler(context);
	context.addEventListener(new ConfigureService());
	context.addEventListener(new NotificationService());

	try {
		server.start();
		LOG.info("Server Started");
		server.join();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}


}
 
开发者ID:opendaylight,项目名称:fpc,代码行数:43,代码来源:JettyServer.java

示例7: main

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Server server = new Server(8080);

    ContextHandlerCollection contexts = new ContextHandlerCollection();
    ServletContextHandler root = new ServletContextHandler(contexts, "/");
    root.addEventListener(new MetricsContextListener());
    root.addFilter(MetricsFilter.class, "/*", EnumSet.allOf(DispatcherType.class))
            .setAsyncSupported(true);
    root.addServlet(ToyWorkServlet.class, "/*");
    server.setHandler(contexts);
    server.start();
    ExecutorService service = Executors.newSingleThreadExecutor();
    service.submit(new RunSomeQueries(8080));
    server.join();
}
 
开发者ID:yahoo,项目名称:metrics-api,代码行数:16,代码来源:EmbeddedMetricsToy.java

示例8: main

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {

		// This test server exposes the CCOW ContextManager according to the
		// HTTP Web bindings and exposes the ContextParticipant notification
		// part through Websockets.

		// Connect to the server at
		// ws://host:serverPort/ws/ContextManager/{unique-client-id}

		// All invocations on ContextParticipants that the ContextManager does
		// according to the HTTP Web bindings spec will also be done to the
		// Websocket client (see ccow.cma.IContextParticipant for procedures
		// that are invoked). As
		// ContextParticipant.ContextChangedPending return values the
		// connected Websocket client will have a max of 5 seconds to respond
		// accordingly.

		server = new Server(2116);
		final CCOWContextListener servletContextListener = new CCOWContextListener();

		final MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
		server.addBean(mbContainer);

		final ServletContextHandler webSocketServletContextHandler = new ServletContextHandler(server, "/ws",
				ServletContextHandler.SESSIONS);
		webSocketServletContextHandler.addEventListener(servletContextListener);
		WebSocketServerContainerInitializer.configureContext(webSocketServletContextHandler);

		final ServletContextHandler restServletContextHandler = new ServletContextHandler(server, "/");
		restServletContextHandler.addEventListener(servletContextListener);
		restServletContextHandler.addFilter(AppGuiceFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));

		final ContextHandlerCollection contexts = new ContextHandlerCollection();
		contexts.setHandlers(new Handler[] { webSocketServletContextHandler, restServletContextHandler });
		
		server.setHandler(contexts);
		server.start();
		server.join();
	}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:40,代码来源:EmbeddedJettyInstance.java

示例9: main

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {

		// This test server exposes the CCOW ContextManager according to the
		// HTTP Web bindings and exposes the ContextParticipant notification
		// part through Websockets.

		// Connect to the server at
		// ws://host:serverPort/ws/ContextManager/{unique-client-id}

		// All invocations on ContextParticipants that the ContextManager does
		// according to the HTTP Web bindings spec will also be done to the
		// Websocket client (see ccow.cma.IContextParticipant for procedures
		// that are invoked). As
		// ContextParticipant.ContextChangedPending return values the
		// connected Websocket client will have a max of 5 seconds to respond
		// accordingly.

		final Server server = new Server(2116);
		final ContextState commonState = new ContextState();
		final CCOWContextListener servletContextListener = new CCOWContextListener(commonState);

		final MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
		server.addBean(mbContainer);

		final ServletContextHandler webSocketServletContextHandler = new ServletContextHandler(server, "/ws",
				ServletContextHandler.SESSIONS);
		webSocketServletContextHandler.addEventListener(servletContextListener);
		WebSocketServerContainerInitializer.configureContext(webSocketServletContextHandler);

		final ServletContextHandler restServletContextHandler = new ServletContextHandler(server, "/");
		restServletContextHandler.addEventListener(servletContextListener);
		restServletContextHandler.addFilter(AppGuiceFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));

		final ContextHandlerCollection contexts = new ContextHandlerCollection();
		contexts.setHandlers(new Handler[] { webSocketServletContextHandler, restServletContextHandler });

		server.setHandler(contexts);
		server.start();
		server.join();
	}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:41,代码来源:EmbeddedJettyTester.java

示例10: beforeClass

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	server = new Server(port);
	final ServletContextHandler sch = new ServletContextHandler(server, "/");
	sch.addEventListener(new CCOWContextListener(commonContext, new InlinedContextAgentRepositoryModule()));
	sch.addFilter(GuiceFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
	sch.addServlet(DefaultServlet.class, "/");
	server.start();
}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:10,代码来源:ClientTestSuite.java

示例11: beforeClass

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
	ccowServer = new Server(serverPort);
	final ServletContextHandler sch = new ServletContextHandler(ccowServer, "/");
	sch.addEventListener(new CCOWContextListener(commonContext, new InlinedContextAgentRepositoryModule()));
	sch.addFilter(AppGuiceFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
	sch.addServlet(DefaultServlet.class, "/");
	ccowServer.start();
}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:10,代码来源:IntegrationTests.java

示例12: generateServletContextHandler

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
private static ServletContextHandler generateServletContextHandler(WebApplicationContext context) throws IOException {
    ServletContextHandler contextHandler = new ServletContextHandler();
    contextHandler.setErrorHandler(generateErrorHandler());
    contextHandler.setContextPath("/");
    contextHandler.addServlet(new ServletHolder(generateDispatcherServlet(context)), "/*");
    contextHandler.addEventListener(new ContextLoaderListener(context));
    return contextHandler;
}
 
开发者ID:Nike-Inc,项目名称:backstopper,代码行数:9,代码来源:Main.java

示例13: generateServletContextHandler

import org.eclipse.jetty.servlet.ServletContextHandler; //导入方法依赖的package包/类
private static ServletContextHandler generateServletContextHandler(
    WebApplicationContext webappContext
) throws IOException {
    ServletContextHandler contextHandler = new ServletContextHandler();
    contextHandler.setContextPath("/");
    contextHandler.addServlet(new ServletHolder(new DispatcherServlet(webappContext)), "/*");
    contextHandler.addEventListener(new ContextLoaderListener(webappContext));
    FilterHolder requestTracingFilterHolder = contextHandler.addFilter(
        RequestTracingFilter.class, "/*", EnumSet.allOf(DispatcherType.class)
    );
    requestTracingFilterHolder.setInitParameter(USER_ID_HEADER_KEYS_LIST_INIT_PARAM_NAME, USER_ID_HEADER_KEYS);
    return contextHandler;
}
 
开发者ID:Nike-Inc,项目名称:wingtips,代码行数:14,代码来源:Main.java

示例14: 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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:14,代码来源:TestServerUtil.java

示例15: 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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:14,代码来源:BaseJPARestTestCase.java


注:本文中的org.eclipse.jetty.servlet.ServletContextHandler.addEventListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。