Examples of Dynamic


Examples of javax.servlet.ServletRegistration.Dynamic

    public void contextInitialized(ServletContextEvent servletContextEvent) {

        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);
        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

Examples of javax.servlet.ServletRegistration.Dynamic

    public static void registerWebActor(ServletContext sc, Class<?> webActorClass) {
        final WebActor waAnn = webActorClass.getAnnotation(WebActor.class);
        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 !!!";
        for (String wsPath : waAnn.webSocketUrlPatterns()) {
View Full Code Here

Examples of javax.servlet.ServletRegistration.Dynamic

    final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
    root.setServletContext(ctx);
    root.scan("app");
    root.refresh();

    final Dynamic servlet = ctx.addServlet("spring", new DispatcherServlet(root));
    servlet.setLoadOnStartup(1);
    servlet.addMapping("/");
  }
View Full Code Here

Examples of javax.servlet.ServletRegistration.Dynamic

    ctx.register(WebAppConfig.class);
    servletContext.addListener(new ContextLoaderListener(ctx));

    ctx.setServletContext(servletContext);

    Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));
    servlet.addMapping("/");
    servlet.setLoadOnStartup(1);
  }
View Full Code Here

Examples of javax.servlet.ServletRegistration.Dynamic

    if (!isEnabled()) {
      logger.info("Filter " + name + " was not registered (disabled)");
      return;
    }
    logger.info("Mapping servlet: '" + name + "' to " + this.urlMappings);
    Dynamic added = servletContext.addServlet(name, this.servlet);
    if (added == null) {
      logger.info("Servlet " + name + " was not registered "
          + "(possibly already registered?)");
      return;
    }
View Full Code Here

Examples of javax.servlet.ServletRegistration.Dynamic

public class H2ConsoleWebInitializer implements WebApplicationInitializer {

  @Override
  public void onStartup(ServletContext container) throws ServletException {
    WebServlet h2Servlet = new WebServlet();
    Dynamic dynamic = container.addServlet("H2Console", h2Servlet);
    dynamic.addMapping("/admin/h2/*");
  }
 
View Full Code Here

Examples of javax.servlet.ServletRegistration.Dynamic

    private void registerWebActor(ServletContext sc, Class<?> webActorClass) {
        final WebActor waAnn = webActorClass.getAnnotation(WebActor.class);
        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
        final ServerContainer scon = (ServerContainer) sc.getAttribute("javax.websocket.server.ServerContainer");
        for (String wsPath : waAnn.webSocketUrlPatterns()) {
            try {
View Full Code Here

Examples of javax.servlet.ServletRegistration.Dynamic

      final RouteyServlet routeyServlet = ctx.createServlet( RouteyServlet.class );

      // force eager initialization to scan routes early
      routeyServlet.init();

      final Dynamic servlet = ctx.addServlet( ROUTEY_SERVLET_NAME, routeyServlet );
      servlet.addMapping( DEFAULT_MAPPING );
    }

  }
View Full Code Here

Examples of org.jboss.test.jmx.compliance.server.support.Dynamic

      ObjectName baseName = new ObjectName("MBeanServerTEST:type=testIsInstanceOf,name=Base");
      ObjectName dynamicName = new ObjectName("MBeanServerTEST:type=testIsInstanceOf,name=Dynamic");
      ObjectName doesNotExistName = new ObjectName("MBeanServerTEST:type=testIsInstanceOf,name=DoesNotExist");

      server.registerMBean(new Base(), baseName);
      server.registerMBean(new Dynamic(), dynamicName);

      assertTrue("Base is not an instance of a class that does not exist",
         server.isInstanceOf(baseName, "does.not.exist") == false);

      assertTrue("FAILS IN RI: Not an instance if the getMBeanInfo reports a class name that does not exist",
View Full Code Here

Examples of org.jnetpcap.packet.annotate.Dynamic

   * @param fields
   *          the fields
   */
  public static void checkAnnotation(Method method, List<AnnotatedField> fields) {

    Dynamic runtime = method.getAnnotation(Dynamic.class);

    if (runtime.field().length() != 0) {

      boolean found = false;
      final String name = runtime.field();
      for (AnnotatedField f : fields) {
        if (f.getName().equals(name)) {
          found = true;
          break;
        }
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.