Package com.caucho.server.dispatch

Examples of com.caucho.server.dispatch.ServletMapping


        webApp.addServlet(servlet);
      }
   
      for (ServletMappingEmbed servletMappingEmbed : _servletMappingList) {
        ServletMapping servletMapping = webApp.createServletMapping();

        servletMappingEmbed.configure(servletMapping);

        webApp.addServletMapping(servletMapping);
      }
View Full Code Here


      hostConfig.addPropertyProgram("web-app", webAppConfig);

      // host.addWebApp(webAppConfig);
     
      ServletMapping mapping = new ServletMapping();
      mapping.addURLPattern("/hmtp");
      mapping.setServletClass("com.caucho.remote.HmtpServlet");
      mapping.setInitParam("authentication-required",
                           String.valueOf(_isAuthenticationRequired));
      mapping.setInitParam("admin", "true");
      mapping.init();

      webAppConfig.addPropertyProgram("servlet-mapping", mapping);
     
      _server.addHost(hostConfig);
     
View Full Code Here

        Class<?> annType = ann.annotationType();
       
        if (annType.equals(WebServlet.class)) {
          WebServlet webServlet = (WebServlet) ann;
     
          ServletMapping mapping = new ServletMapping();

          for (String value : webServlet.value()) {
            mapping.addURLPattern(value);
          }
         
          for (String value : webServlet.urlPatterns()) {
            mapping.addURLPattern(value);
          }
         
          mapping.setBean(bean);
       
          mapping.init();

          _webApp.addServletMapping(mapping);

          event.veto();
        }
        else if (annType.isAnnotationPresent(ServiceType.class)) {
          ServiceType serviceType
            = (ServiceType) annType.getAnnotation(ServiceType.class);

          Class<?> factoryClass = serviceType.defaultFactory();
          ProtocolServletFactory factory
            = (ProtocolServletFactory) factoryClass.newInstance();

          factory.setServiceType(ann);
          factory.setAnnotated(annotated);

          Method urlPatternMethod = annType.getMethod("urlPattern");

          String urlPattern = (String) urlPatternMethod.invoke(ann);
     
          ServletMapping mapping = new ServletMapping();
          mapping.addURLPattern(urlPattern);
          mapping.setBean(bean);

          mapping.setProtocolFactory(factory);
       
          mapping.init();

          _webApp.addServletMapping(mapping);

          // event.veto();
        }
View Full Code Here

  }

  public void addServlet(WebServlet webServlet, String servletClassName)
    throws ServletException
  {
    ServletMapping mapping = createServletMapping();
    mapping.setServletClass(servletClassName);

    String name = webServlet.name();

    if (name == null || "".equals(name))
      name = servletClassName;

    mapping.setServletName(name);

    if (webServlet.value().length > 0 && webServlet.urlPatterns().length == 0) {
      for (String url : webServlet.value())
        mapping.addURLPattern(url); // XXX: support addURLRegexp?
    }
    else if (webServlet.urlPatterns().length > 0 &&
             webServlet.value().length == 0) {
      for (String url : webServlet.urlPatterns()) {
        mapping.addURLPattern(url); // XXX: support addURLRegexp?
      }
    } else {
      throw new ConfigException(L.l("Annotation @WebServlet at '{0}' must specify either value or urlPatterns", servletClassName));
    }

    for (WebInitParam initParam : webServlet.initParams())
      mapping.setInitParam(initParam.name(), initParam.value()); //omit description

    mapping.setLoadOnStartup(webServlet.loadOnStartup());
    mapping.setAsyncSupported(webServlet.asyncSupported());

    addServletMapping(mapping);
  }
View Full Code Here

    _servletManager.setLazyValidate(isLazy);
  }

  public ServletMapping createServletMapping()
  {
    ServletMapping servletMapping = new ServletMapping();

    if (_isApplyingWebFragments)
      servletMapping.setInFragmentMode();

    servletMapping.setWebApp(this);
    servletMapping.setServletContext(this);
    servletMapping.setServletMapper(_servletMapper);
    servletMapping.setStrictMapping(getStrictMapping());

    return servletMapping;
  }
View Full Code Here

  public void addServletRegexp(ServletRegexp servletRegexp)
    throws ServletException, ClassNotFoundException
  {
    // servletRegexp.initRegexp(this, _servletMapper, _regexp);

    ServletMapping mapping = new ServletMapping();
   
    mapping.addURLRegexp(servletRegexp.getURLRegexp());
    mapping.setServletName(servletRegexp.getServletName());
    if (servletRegexp.getServletClass() != null)
      mapping.setServletClass(servletRegexp.getServletClass());
    mapping.setServletContext(this);
    servletRegexp.getBuilderProgram().configure(mapping);
    mapping.setStrictMapping(getStrictMapping());
    mapping.init(_servletMapper);

    //_servletMapper.addServletRegexp(mapping);
  }
View Full Code Here

  @PostConstruct
  public void init()
    throws ServletException
  {
    if (_webApp != null) {
      ServletMapping mapping = _webApp.createServletMapping();
      mapping.setServletName("jsp-property-group-" + _gId++);
     
      if (Boolean.TRUE.equals(_isXml))
        mapping.setServletClass(JspXmlServlet.class.getName());
      else
        mapping.setServletClass(JspServlet.class.getName());

      for (int i = 0; i < _urlPatterns.size(); i++) {
        mapping.addURLPattern(_urlPatterns.get(i));
      }

      _webApp.addServletMapping(mapping);
    }
  }
View Full Code Here

    if (jsfPropertyGroup != null && jsfPropertyGroup.isEnableDeveloperAid()) {
      developerAidListener = new JsfDeveloperAid();

      //will use Servlet 3.0
      ServletMapping servletMapping = WebApp.getCurrent()
        .createServletMapping();

      servletMapping.addURLPattern("/caucho.jsf.developer.aid");
      servletMapping.setServletClass(JsfDeveloperAidServlet.class.getName());

      WebApp.getCurrent().addServletMapping(servletMapping);
    }

    Iterator iter = lifecycleFactory.getLifecycleIds();
View Full Code Here

    webAppConfig.setId(_serviceName);
    webAppConfig.setRootDirectory(new RawString("memory:/admin-dummy-root"));

    hostConfig.addBuilderProgram(new PropertyValueProgram("web-app", webAppConfig));

    ServletMapping servlet = new ServletMapping();

    servlet.setServletName(_serviceName);
    servlet.addURLPattern("/*");
    servlet.addURLRegexp(".*");
    servlet.setServletClass(ManagementServlet.class.getName());

    ContainerProgram servletInit = new ContainerProgram();
    servletInit.addProgram(new PropertyValueProgram("service", this));
    servlet.setInit(servletInit);

    webAppConfig.addBuilderProgram(new PropertyValueProgram("servlet-mapping", servlet));

    SecurityConstraint constraint = new SecurityConstraint();
    constraint.addURLPattern("/*");
 
View Full Code Here

      hostConfig.addPropertyProgram("web-app", webAppConfig);

      // host.addWebApp(webAppConfig);
     
      ServletMapping mapping = new ServletMapping();
      mapping.addURLPattern("/hmtp");
      mapping.setServletClass("com.caucho.remote.HmtpServlet");
      mapping.setInitParam("authentication-required",
         String.valueOf(_isAuthenticationRequired));
      mapping.setInitParam("admin", "true");
      mapping.init();

      webAppConfig.addPropertyProgram("servlet-mapping", mapping);
     
      _server.addHost(hostConfig);
View Full Code Here

TOP

Related Classes of com.caucho.server.dispatch.ServletMapping

Copyright © 2018 www.massapicom. 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.