Package org.eclipse.jetty.servlet

Examples of org.eclipse.jetty.servlet.ServletContextHandler.addEventListener()


        Server server = SERVERS.get(port);
        if (server == null) {
          ServletContextHandler servletContextHandler = new ServletContextHandler();
          servletContextHandler.addServlet(AdminServlet.class, "/*");
         
          servletContextHandler.addEventListener(new MetricsServlet.ContextListener() {     
            @Override
            protected MetricRegistry getMetricRegistry() {
              return context.getMetricRegistry();
            }
            @Override
View Full Code Here


            protected TimeUnit getDurationUnit() {
              return defaultDurationUnit;
            }
          });
         
          servletContextHandler.addEventListener(new HealthCheckServlet.ContextListener() {        
            @Override
            protected HealthCheckRegistry getHealthCheckRegistry() {
              return context.getHealthCheckRegistry();
            }
          });
View Full Code Here

    public EmbeddedJettyServer(int port, String contextPath, String servletPath, Servlet servlet, final MuleContext context)
    {
        httpServer = new Server(port);
        ServletContextHandler c = new ServletContextHandler(httpServer, contextPath, ServletContextHandler.SESSIONS);
        c.addServlet(new ServletHolder(servlet), servletPath);
        c.addEventListener(new ServletContextListener()
        {
            public void contextInitialized(ServletContextEvent sce)
            {
                sce.getServletContext().setAttribute(MuleProperties.MULE_CONTEXT_PROPERTY, context);
            }
View Full Code Here

            resourceHandler.setResourceBase(resourceBase);
            resourceContextHandler.setHandler(resourceHandler);
        }

        ServletContextHandler servletContext = new ServletContextHandler(contexts, ROOT, ServletContextHandler.NO_SECURITY);
        servletContext.addEventListener(new MuleServletContextListener(muleContext, getName()));
        servletContext.setVirtualHosts(new String[] {getVirtualHostName(connector)});

        ServletHolder holder = new ServletHolder();
        holder.setServlet(servlet);
        servletContext.addServlet(holder, "/*");
 
View Full Code Here

        }

        ContextHandlerCollection handlerCollection = new ContextHandlerCollection();
        ServletContextHandler root = new ServletContextHandler(handlerCollection, ROOT, ServletContextHandler.NO_SECURITY);
        root.setVirtualHosts(new String[] { getVirtualHostName(connector) });
        root.addEventListener(new MuleServletContextListener(muleContext, getName()));

        if (!ROOT.equals(path))
        {
            ServletContextHandler resourceContext = new ServletContextHandler(handlerCollection, path, ServletContextHandler.NO_SECURITY);
            populateContext(resourceContext);
View Full Code Here

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");
        server.setHandler(context);

        context.addEventListener(new CdiServletRequestListener());
        context.addServlet(new ServletHolder(new RequestServlet()),"/*");

        server.start();
        return port;
    }
View Full Code Here

                server,
                "/",
                ServletContextHandler.SESSIONS);
        handler.addServlet(DefaultServlet.class, "/");
        handler.addFilter(GuiceFilter.class, "/*", null);
        handler.addEventListener(new GuiceServletContextListener() {
            @Override
            protected Injector getInjector() {
                return Guice.createInjector(new ServletModule() {
                    @Override
                    protected void configureServlets() {
View Full Code Here

    public void testSpringWiringOfOort() throws Exception
    {
        Server server = new Server();
        ServletContextHandler context = new ServletContextHandler(server, "/");
        WebSocketServerContainerInitializer.configureContext(context);
        context.addEventListener(new ContextLoaderListener());
        context.getInitParams().put(ContextLoader.CONFIG_LOCATION_PARAM, "classpath:/applicationContext.xml");
        server.start();

        ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context.getServletContext());
View Full Code Here

 
  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);
View Full Code Here

 
  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);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.