Package org.jboss.metadata.web.spec

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


            deployment.setListeners(listeners);
         }
         listeners.add(0, WBL);
         listeners.add(1, JIL);

         FiltersMetaData filters = deployment.getFilters();
         if (filters == null)
         {
            filters = new FiltersMetaData();
            deployment.setFilters(filters);
         }
         filters.add(CPF);

         List<FilterMappingMetaData> filterMappings = deployment.getFilterMappings();
         if (filterMappings == null)
         {
            filterMappings = new ArrayList<FilterMappingMetaData>();
View Full Code Here


            context.addErrorPage(errorPage);
         }
      }

      // Filter definitions
      FiltersMetaData filters = metaData.getFilters();
      if (filters != null)
      {
         for (FilterMetaData value : filters)
         {
            org.apache.catalina.deploy.FilterDef filterDef = new org.apache.catalina.deploy.FilterDef();
View Full Code Here

      }
      mapping.setUrlPatterns(patterns);

      if (webdata.getFilters() == null)
      {
         webdata.setFilters(new FiltersMetaData());
      }
      webdata.getFilters().add(filter);
      List<FilterMappingMetaData> mappings = webdata.getFilterMappings();
      if (mappings == null)
      {
View Full Code Here

        final WebComponentDescription componentDescription = new WebComponentDescription(JSP_LISTENER, JSP_LISTENER, module, deploymentUnit.getServiceName(), applicationClasses);
        module.addComponent(componentDescription);
        final Map<String, ComponentInstantiator> instantiators = deploymentUnit.getAttachment(WebAttachments.WEB_COMPONENT_INSTANTIATORS);
        instantiators.put(JSP_LISTENER, new WebComponentInstantiator(deploymentUnit, componentDescription));

        FiltersMetaData filters = webMetaData.getFilters();
        if (filters == null) {
            filters = new FiltersMetaData();
            webMetaData.setFilters(filters);
        }
        filters.add(CPF);

        List<FilterMappingMetaData> filterMappings = webMetaData.getFilterMappings();
        if (filterMappings == null) {
            filterMappings = new ArrayList<FilterMappingMetaData>();
            webMetaData.setFilterMappings(filterMappings);
View Full Code Here

                context.addErrorPage(errorPage);
            }
        }

        // Filter definitions
        FiltersMetaData filters = metaData.getFilters();
        if (filters != null) {
            for (FilterMetaData value : filters) {
                org.apache.catalina.deploy.FilterDef filterDef = new org.apache.catalina.deploy.FilterDef();
                filterDef.setFilterName(value.getName());
                filterDef.setFilterClass(value.getFilterClass());
View Full Code Here

            context.addErrorPage(errorPage);
         }
      }

      // Filter definitions
      FiltersMetaData filters = metaData.getFilters();
      if (filters != null)
      {
         for (FilterMetaData value : filters)
         {
            org.apache.catalina.deploy.FilterDef filterDef = new org.apache.catalina.deploy.FilterDef();
View Full Code Here

                context.addErrorPage(errorPage);
            }
        }

        // Filter definitions
        FiltersMetaData filters = metaData.getFilters();
        if (filters != null) {
            for (FilterMetaData value : filters) {
                org.apache.catalina.deploy.FilterDef filterDef = new org.apache.catalina.deploy.FilterDef();
                filterDef.setFilterName(value.getName());
                filterDef.setFilterClass(value.getFilterClass());
View Full Code Here

                context.addErrorPage(errorPage);
            }
        }

        // Filter definitions
        FiltersMetaData filters = metaData.getFilters();
        if (filters != null) {
            for (FilterMetaData value : filters) {
                org.apache.catalina.deploy.FilterDef filterDef = new org.apache.catalina.deploy.FilterDef();
                filterDef.setFilterName(value.getName());
                filterDef.setFilterClass(value.getFilterClass());
View Full Code Here

            metaData.setServletMappings(servletMappings);
        }
        // @WebFilter
        final List<AnnotationInstance> webFilterAnnotations = index.getAnnotations(webFilter);
        if (webFilterAnnotations != null && webFilterAnnotations.size() > 0) {
            FiltersMetaData filters = new FiltersMetaData();
            List<FilterMappingMetaData> filterMappings = new ArrayList<FilterMappingMetaData>();
            for (final AnnotationInstance annotation : webFilterAnnotations) {
                FilterMetaData filter = new FilterMetaData();
                AnnotationTarget target = annotation.target();
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@WebFilter is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                filter.setFilterClass(classInfo.toString());
                AnnotationValue nameValue = annotation.value("filterName");
                if (nameValue == null || nameValue.asString().isEmpty()) {
                    filter.setName(classInfo.toString());
                } else {
                    filter.setName(nameValue.asString());
                }
                AnnotationValue asyncSupported = annotation.value("asyncSupported");
                if (asyncSupported != null) {
                    filter.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);
                        }
                        filter.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) {
                    filter.setDescriptionGroup(descriptionGroup);
                }
                filters.add(filter);
                FilterMappingMetaData filterMapping = new FilterMappingMetaData();
                filterMapping.setFilterName(filter.getName());
                List<String> urlPatterns = new ArrayList<String>();
                List<String> servletNames = new ArrayList<String>();
                List<DispatcherType> dispatchers = new ArrayList<DispatcherType>();
View Full Code Here

   }
  
   private void assertFilters(WebMetaData webApp)
      throws Exception
   {
      FiltersMetaData filters = webApp.getFilters();
      assertEquals(2, filters.size());
      FilterMetaData f0 = filters.get("filter0Name");
      assertEquals("filter0Class", f0.getFilterClass());
      int count = 0;
      for(FilterMetaData f : filters)
      {
         assertEquals("filter"+count, f.getId());
View Full Code Here

TOP

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

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.