Package org.jboss.metadata.web.spec

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


      // create wbl listener
      WBL = new ListenerMetaData();
      WBL.setListenerClass("org.jboss.weld.servlet.WeldListener");
      JIL = new ListenerMetaData();
      JIL.setListenerClass("org.jboss.weld.integration.webtier.jsp.JspInitializationListener");
      CPF = new FilterMetaData();
      CPF.setFilterName("Weld Conversation Propagation Filter");
      CPF.setFilterClass("org.jboss.weld.servlet.ConversationPropagationFilter");
      CPF.setAsyncSupported(true);
      CPFM = new FilterMappingMetaData();
      CPFM.setFilterName("Weld Conversation Propagation Filter");
View Full Code Here


      if (resteasy.getScannedApplicationClass() == null
              && resteasy.getScannedJndiComponentResources().isEmpty()
              && resteasy.getScannedProviderClasses().isEmpty()
              && resteasy.getScannedResourceClasses().isEmpty()) return;

      FilterMetaData filter = new FilterMetaData();
      filter.setFilterClass(Filter30Dispatcher.class.getName());
      filter.setName("Resteasy");
      filter.setAsyncSupported(true);

      FilterMappingMetaData mapping = new FilterMappingMetaData();
      mapping.setFilterName("Resteasy");
      List<String> patterns = new ArrayList<String>();
      if (useScannedApplicationClass && resteasy.getScannedApplicationClass().isAnnotationPresent(ApplicationPath.class))
View Full Code Here

        // create wbl listener
        WBL = new ListenerMetaData();
        WBL.setListenerClass(WELD_LISTENER);
        JIL = new ListenerMetaData();
        JIL.setListenerClass(JSP_LISTENER);
        CPF = new FilterMetaData();
        CPF.setFilterName("Weld Conversation Propagation Filter");
        CPF.setFilterClass(CONVERSATION_FILTER);
        CPF.setAsyncSupported(true);
        CPFM = new FilterMappingMetaData();
        CPFM.setFilterName("Weld Conversation Propagation Filter");
View Full Code Here

        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>();
                AnnotationValue urlPatternsValue = annotation.value("urlPatterns");
                if (urlPatternsValue != null) {
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());
         assertEquals("filter"+count+"Class", f.getFilterClass());
View Full Code Here

            log.debug("Configuring RHQ response-time servlet filter for WAR " + deploymentUnit.getName() + "...");

            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>();
                rtFilter.setInitParam(initParams);
            }
            for (String paramName : RtFilterExtension.INIT_PARAMS.keySet()) {
                ParamValueMetaData initParam = new ParamValueMetaData();
                initParam.setParamName(paramName);
                String paramValue = RtFilterExtension.INIT_PARAMS.get(paramName);
                initParam.setParamValue(paramValue);
                initParams.add(initParam);
            }

            boolean filterMappingAlreadyConfigured = false;
            List<FilterMappingMetaData> filterMappings = webMetaData.getFilterMappings();
            if (filterMappings != null) {
                for (FilterMappingMetaData filterMapping : filterMappings) {
                    if (filterMapping.getFilterName().equals(rtFilter.getFilterName())) {
                        // a mapping for the filter's already configured in this webapp.
                        filterMappingAlreadyConfigured = true;
                        break;
                    }
                }
            } else {
                filterMappings = new ArrayList<FilterMappingMetaData>();
                webMetaData.setFilterMappings(filterMappings);
            }

            if (!filterMappingAlreadyConfigured) {
                FilterMappingMetaData filterMapping = new FilterMappingMetaData();
                filterMapping.setFilterName(rtFilter.getFilterName());
                filterMapping.setUrlPatterns(Arrays.asList("/*"));
                filterMappings.add(filterMapping);
            }
        }
    }
View Full Code Here

        // create wbl listener
        INITIAL_LISTENER_METADATA = new ListenerMetaData();
        INITIAL_LISTENER_METADATA.setListenerClass(WELD_INITIAL_LISTENER);
        TERMINAL_LISTENER_MEDATADA = new ListenerMetaData();
        TERMINAL_LISTENER_MEDATADA.setListenerClass(WELD_TERMINAL_LISTENER);
        conversationFilterMetadata = new FilterMetaData();
        conversationFilterMetadata.setFilterClass(CONVERSATION_FILTER_CLASS);
        conversationFilterMetadata.setFilterName(CONVERSATION_FILTER_NAME);
        conversationFilterMetadata.setAsyncSupported(true);
        CONVERSATION_FILTER_INITIALIZED.setParamName(ConversationFilter.CONVERSATION_FILTER_REGISTERED);
        CONVERSATION_FILTER_INITIALIZED.setParamValue(Boolean.TRUE.toString());
View Full Code Here

        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>();
                AnnotationValue urlPatternsValue = annotation.value("urlPatterns");
                if (urlPatternsValue != null) {
View Full Code Here

        // create wbl listener
        WBL = new ListenerMetaData();
        WBL.setListenerClass(WELD_LISTENER);
        JIL = new ListenerMetaData();
        JIL.setListenerClass(JSP_LISTENER);
        CPF = new FilterMetaData();
        CPF.setFilterName("Weld Conversation Propagation Filter");
        CPF.setFilterClass(CONVERSATION_FILTER);
        CPF.setAsyncSupported(true);
        CPFM = new FilterMappingMetaData();
        CPFM.setFilterName("Weld Conversation Propagation Filter");
View Full Code Here

        // create wbl listener
        WBL = new ListenerMetaData();
        WBL.setListenerClass(WELD_LISTENER);
        JIL = new ListenerMetaData();
        JIL.setListenerClass(JSP_LISTENER);
        CPF = new FilterMetaData();
        CPF.setFilterName("Weld Conversation Propagation Filter");
        CPF.setFilterClass(CONVERSATION_FILTER);
        CPFM = new FilterMappingMetaData();
        CPFM.setFilterName("Weld Conversation Propagation Filter");
        CPFM.setUrlPatterns(Arrays.asList("/*"));
 
View Full Code Here

TOP

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

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.