Package org.jboss.metadata.web.spec

Examples of org.jboss.metadata.web.spec.ServletsMetaData


      if(original != null)
         originalRoles = original.getSecurityRoles();
      securityRoles.merge(overrideRoles, originalRoles);

      JBossServletsMetaData soverride = null;
      ServletsMetaData soriginal = null;
      if(override != null)
         soverride = override.getServlets();
      if(original != null)
         soriginal = original.getServlets();
      servlets = JBossServletsMetaData.merge(soverride, soriginal);
View Full Code Here


      EnvironmentRefsGroupMetaData env = new EnvironmentRefsGroupMetaData();
      super.process(env, type);
      metaData.setJndiEnvironmentRefsGroup(env);

      // @RunAs
      ServletsMetaData servlets = metaData.getServlets();
      if(servlets == null)
      {
         servlets = new ServletsMetaData();
         metaData.setServlets(servlets);
      }
      super.processClass(servlets, type);
      // @DeclareRoles
      SecurityRolesMetaData securityRoles = metaData.getSecurityRoles();
View Full Code Here

    }

    WebMetaData create() {
        final WebMetaData metadata = new WebMetaData();

        metadata.setServlets(new ServletsMetaData());

        // Add DefaultServlet
        enableStaticResouces(metadata);
        // Add JSPServlet
        enableJsp(metadata);
View Full Code Here

      if(original != null)
         originalRoles = original.getSecurityRoles();
      securityRoles.merge(overrideRoles, originalRoles);

      JBossServletsMetaData soverride = null;
      ServletsMetaData soriginal = null;
      if(override != null)
         soverride = override.getServlets();
      if(original != null)
         soriginal = original.getServlets();
      servlets = JBossServletsMetaData.merge(soverride, soriginal);
View Full Code Here

         metaData.setJndiEnvironmentRefsGroup(env);  
      }
      super.process(env, type);
     
      // @RunAs
      ServletsMetaData servlets = metaData.getServlets();
      if(servlets == null)
      {
         servlets = new ServletsMetaData();
         metaData.setServlets(servlets);
      }
      super.processClass(servlets, type);
     
      // @DeclareRoles
View Full Code Here

    throws DeploymentUnitProcessingException {
        Web30MetaData metaData = new Web30MetaData();
        // @WebServlet
        final List<AnnotationInstance> webServletAnnotations = index.getAnnotations(webServlet);
        if (webServletAnnotations != null && webServletAnnotations.size() > 0) {
            ServletsMetaData servlets = new ServletsMetaData();
            List<ServletMappingMetaData> servletMappings = new ArrayList<ServletMappingMetaData>();
            for (final AnnotationInstance annotation : webServletAnnotations) {
                ServletMetaData servlet = new ServletMetaData();
                AnnotationTarget target = annotation.target();
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@WebServlet is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                servlet.setServletClass(classInfo.toString());
                AnnotationValue nameValue = annotation.value("name");
                if (nameValue == null || nameValue.asString().isEmpty()) {
                    servlet.setName(classInfo.toString());
                } else {
                    servlet.setName(nameValue.asString());
                }
                AnnotationValue loadOnStartup = annotation.value("loadOnStartup");
                if (loadOnStartup != null && loadOnStartup.asInt() > 0) {
                    servlet.setLoadOnStartupInt(loadOnStartup.asInt());
                }
                AnnotationValue asyncSupported = annotation.value("asyncSupported");
                if (asyncSupported != null) {
                    servlet.setAsyncSupported(asyncSupported.asBoolean());
                }
                AnnotationValue initParamsValue = annotation.value("initParams");
                if (initParamsValue != null) {
                    AnnotationInstance[] initParamsAnnotations = initParamsValue.asNestedArray();
                    if (initParamsAnnotations != null && initParamsAnnotations.length > 0) {
                        List<ParamValueMetaData> initParams = new ArrayList<ParamValueMetaData>();
                        for (AnnotationInstance initParamsAnnotation : initParamsAnnotations) {
                            ParamValueMetaData initParam = new ParamValueMetaData();
                            AnnotationValue initParamName = initParamsAnnotation.value("name");
                            AnnotationValue initParamValue = initParamsAnnotation.value();
                            if (initParamName == null || initParamValue == null) {
                                throw new DeploymentUnitProcessingException("@WebInitParam requires name and value on " + target);
                            }
                            AnnotationValue initParamDescription = initParamsAnnotation.value("description");
                            initParam.setParamName(initParamName.asString());
                            initParam.setParamValue(initParamValue.asString());
                            if (initParamDescription != null) {
                                Descriptions descriptions = getDescription(initParamDescription.asString());
                                if (descriptions != null) {
                                    initParam.setDescriptions(descriptions);
                                }
                            }
                            initParams.add(initParam);
                        }
                        servlet.setInitParam(initParams);
                    }
                }
                AnnotationValue descriptionValue = annotation.value("description");
                AnnotationValue displayNameValue = annotation.value("displayName");
                AnnotationValue smallIconValue = annotation.value("smallIcon");
                AnnotationValue largeIconValue = annotation.value("largeIcon");
                DescriptionGroupMetaData descriptionGroup =
                    getDescriptionGroup((descriptionValue == null) ? "" : descriptionValue.asString(),
                            (displayNameValue == null) ? "" : displayNameValue.asString(),
                            (smallIconValue == null) ? "" : smallIconValue.asString(),
                            (largeIconValue == null) ? "" : largeIconValue.asString());
                if (descriptionGroup != null) {
                    servlet.setDescriptionGroup(descriptionGroup);
                }
                ServletMappingMetaData servletMapping = new ServletMappingMetaData();
                servletMapping.setServletName(servlet.getName());
                List<String> urlPatterns = new ArrayList<String>();
                AnnotationValue urlPatternsValue = annotation.value("urlPatterns");
                if (urlPatternsValue != null) {
                    for (String urlPattern : urlPatternsValue.asStringArray()) {
                        urlPatterns.add(urlPattern);
                    }
                }
                urlPatternsValue = annotation.value();
                if (urlPatternsValue != null) {
                    for (String urlPattern : urlPatternsValue.asStringArray()) {
                        urlPatterns.add(urlPattern);
                    }
                }
                if (urlPatterns.size() > 0) {
                    servletMapping.setUrlPatterns(urlPatterns);
                    servletMappings.add(servletMapping);
                }
                servlets.add(servlet);
            }
            metaData.setServlets(servlets);
            metaData.setServletMappings(servletMappings);
        }
        // @WebFilter
View Full Code Here

      }
   }
   private void assertServlets(WebMetaData webApp)
      throws Exception
   {
      ServletsMetaData servlets = webApp.getServlets();
      int count = 0;
      for(ServletMetaData servlet : servlets)
      {
         assertEquals("servlet"+count, servlet.getId());
         assertEquals("servlet"+count+"-name", servlet.getServletName());
View Full Code Here

    }

    WebMetaData create() {
        final WebMetaData metadata = new WebMetaData();

        metadata.setServlets(new ServletsMetaData());

        // Add DefaultServlet
        enableStaticResouces(metadata);
        // Add JSPServlet
        enableJsp(metadata);
View Full Code Here

      if(original != null)
         originalRoles = original.getSecurityRoles();
      securityRoles.merge(overrideRoles, originalRoles);

      JBossServletsMetaData soverride = null;
      ServletsMetaData soriginal = null;
      if(override != null)
         soverride = override.getServlets();
      if(original != null)
         soriginal = original.getServlets();
      servlets = JBossServletsMetaData.merge(soverride, soriginal);
View Full Code Here

    }

    WebMetaData create() {
        final WebMetaData metadata = new WebMetaData();

        metadata.setServlets(new ServletsMetaData());

        // Session config
        final SessionConfigMetaData sessionConfig = new SessionConfigMetaData();
        sessionConfig.setSessionTimeout(30);
        metadata.setSessionConfig(sessionConfig);
View Full Code Here

TOP

Related Classes of org.jboss.metadata.web.spec.ServletsMetaData

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.