Package org.jboss.metadata.web.spec

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


            final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
            WebMetaData webMetaData = warMetaData.getSharedWebMetaData();

            FilterMetaData rtFilter = null;
            FiltersMetaData filters = webMetaData.getFilters();
            if (filters != null) {
                for (FilterMetaData filter : filters) {
                    if (RtFilter.class.getName().equals(filter.getFilterClass())) {
                        // the filter's already configured in this webapp.
                        rtFilter = filter;
                        break;
                    }
                }
            } else {
                filters = new FiltersMetaData();
                webMetaData.setFilters(filters);
            }
            if (rtFilter == null) {
                rtFilter = new FilterMetaData();
                rtFilter.setFilterName(RT_FILTER_NAME);
                rtFilter.setFilterClass(RtFilter.class.getName());
                filters.add(rtFilter);
            }

            List<ParamValueMetaData> initParams = rtFilter.getInitParam();
            if (initParams == null) {
                initParams = new ArrayList<ParamValueMetaData>();
View Full Code Here


            if (filterMappingFound) { // otherwise WeldListener will take care of conversation context activation
                boolean filterFound = false;
                // register ConversationFilter
                if (webMetaData.getFilters() == null) {
                    webMetaData.setFilters(new FiltersMetaData());
                }
                for (FilterMetaData filter : webMetaData.getFilters()) {
                    if (CONVERSATION_FILTER_CLASS.equals(filter.getFilterClass())) {
                        filterFound = true;
                        break;
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(UndertowLogger.ROOT_LOGGER.invalidWebFilterAnnotation(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(UndertowLogger.ROOT_LOGGER.invalidWebInitParamAnnotation(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

                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

        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

        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

        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

            listeners = new ArrayList<ListenerMetaData>();
            deployment.setListeners(listeners);
         }
         listeners.add(WBL);
        
         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();
                filterDef.setFilterName(value.getName());
                filterDef.setFilterClass(value.getFilterClass());
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.