Package javax.servlet.ServletRegistration

Examples of javax.servlet.ServletRegistration.Dynamic.addMapping()


    /**
     * Uses dynamic servlet registartaion for registering PushServlet automatically
     */
    private static void registerPushServlet(ServletContext context) {
        Dynamic dynamicRegistration = context.addServlet("AutoRegisteredPushServlet", PushServlet.class);
        dynamicRegistration.addMapping(PUSH_CONTEXT_DEFAULT_MAPPING);
        dynamicRegistration.setAsyncSupported(true);

        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Auto-registered servlet " + PushServlet.class.getSimpleName() + " with mapping '" + PUSH_CONTEXT_DEFAULT_MAPPING + "'");
        }
View Full Code Here


        }
    }

    private static void registerServlet(ServletContext context) {
        Dynamic dynamicRegistration = context.addServlet("AutoRegisteredResourceServlet", ResourceServlet.class);
        dynamicRegistration.addMapping(RICHFACES_RESOURCES_DEFAULT_MAPPING);

        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Auto-registered servlet " + ResourceServlet.class.getSimpleName() + " with mapping '" + RICHFACES_RESOURCES_DEFAULT_MAPPING + "'");
        }
    }
View Full Code Here

  public void onStartup(ServletContext servletContext) throws ServletException {

    TomcatBitcoinServlet servlet = new TomcatBitcoinServlet();

    Dynamic registration = servletContext.addServlet("ws", servlet);
    registration.addMapping("/tomcat");
    registration.setLoadOnStartup(1);

    Broadcaster broadcaster = servlet;

    AbstractMtgoxClient mtgoxClient = new StubMtgoxClient(broadcaster);
View Full Code Here

        ServletContext servletContext = arg0.getServletContext();
        try {
            // addServlet takes instance created by ServletContext.createServlet()
            Servlet servlet5_1 = servletContext.createServlet(SampleServlet5.class);
            Dynamic dynamic5_1 = servletContext.addServlet("Sample Servlet 5_1", servlet5_1);
            dynamic5_1.addMapping("/SampleServlet5_1", "/SampleServlet5_1/*");

            // addServlet takes instance which is not created by ServletContext.createServlet()
            Dynamic dynamic5_2 = servletContext.addServlet("Sample Servlet 5_2", new SampleServlet5());
            dynamic5_2.addMapping("/SampleServlet5_2", "/SampleServlet5_2/*");

 
View Full Code Here

            Dynamic dynamic5_1 = servletContext.addServlet("Sample Servlet 5_1", servlet5_1);
            dynamic5_1.addMapping("/SampleServlet5_1", "/SampleServlet5_1/*");

            // addServlet takes instance which is not created by ServletContext.createServlet()
            Dynamic dynamic5_2 = servletContext.addServlet("Sample Servlet 5_2", new SampleServlet5());
            dynamic5_2.addMapping("/SampleServlet5_2", "/SampleServlet5_2/*");

            // addServlet takes className
            Dynamic dynamic5_3 = servletContext.addServlet("Sample Servlet 5_3", SampleServlet5.class);
            dynamic5_3.addMapping("/SampleServlet5_3", "/SampleServlet5_3/*");

 
View Full Code Here

            Dynamic dynamic5_2 = servletContext.addServlet("Sample Servlet 5_2", new SampleServlet5());
            dynamic5_2.addMapping("/SampleServlet5_2", "/SampleServlet5_2/*");

            // addServlet takes className
            Dynamic dynamic5_3 = servletContext.addServlet("Sample Servlet 5_3", SampleServlet5.class);
            dynamic5_3.addMapping("/SampleServlet5_3", "/SampleServlet5_3/*");

            //
            Servlet servlet6 = servletContext.createServlet(SampleServlet6.class);
            Dynamic dynamic6 = servletContext.addServlet("Sample Servlet 6", servlet6);
            dynamic6.addMapping("/SampleServlet6_1");
View Full Code Here

            dynamic5_3.addMapping("/SampleServlet5_3", "/SampleServlet5_3/*");

            //
            Servlet servlet6 = servletContext.createServlet(SampleServlet6.class);
            Dynamic dynamic6 = servletContext.addServlet("Sample Servlet 6", servlet6);
            dynamic6.addMapping("/SampleServlet6_1");

        } catch (ServletException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        ServletContext servletContext = servletContextEvent.getServletContext();

        //dynamic register /SampleServlet3Dynamic and security constraint
        Dynamic servlet3Dynamic = servletContext.addServlet("SampleServlet3Dynamic", SampleServlet3.class);
        servlet3Dynamic.addMapping("/SampleServlet3Dynamic", "/TestDynamic");
        HttpConstraintElement httpConstraintElement = new HttpConstraintElement();
        List<HttpMethodConstraintElement> httpMethodConstraintElements = new ArrayList<HttpMethodConstraintElement>();
        httpMethodConstraintElements.add(new HttpMethodConstraintElement("GET", new HttpConstraintElement(ServletSecurity.TransportGuarantee.NONE, "RoleC")));
        ServletSecurityElement servletSecurityElement = new ServletSecurityElement(httpConstraintElement, httpMethodConstraintElements);
        Set<String> uneffectedUrlPatterns = servlet3Dynamic.setServletSecurity(servletSecurityElement);
View Full Code Here

        ServletSecurityElement servletSecurityElement = new ServletSecurityElement(httpConstraintElement, httpMethodConstraintElements);
        Set<String> uneffectedUrlPatterns = servlet3Dynamic.setServletSecurity(servletSecurityElement);
        if (uneffectedUrlPatterns.size() == 0) {
            throw new RuntimeException("/SampleServlet3Dynamic should be returned as it is defined in the web.xml file");
        }
        servlet3Dynamic.addMapping("/TestDynamicAfter");
    }
}
View Full Code Here

        final String name = (waAnn.name() != null && !waAnn.name().isEmpty()) ? waAnn.name() : webActorClass.getName();
        // servlet
        Dynamic d = sc.addServlet(name, WebActorServlet.class);
        d.setInitParameter(WebActorServlet.ACTOR_CLASS_PARAM, webActorClass.getName());
        d.setAsyncSupported(true);
        d.addMapping(waAnn.httpUrlPatterns());
        d.addMapping(waAnn.value());

        // web socket
        ServerContainer scon = (ServerContainer) sc.getAttribute("javax.websocket.server.ServerContainer");
        assert scon!=null : "Container does not support websockets !!!";
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.