Examples of FilterMapping


Examples of org.apache.jetspeed.om.portlet.FilterMapping

        ip4.setParamValue("value for filter init param 2");
        filter.addLifecycle("lifecycle-1");
        filter.addLifecycle("lifecycle-2");
        filter.addLifecycle("lifecycle-3");
       
        FilterMapping mapping1 = app.addFilterMapping("filter-1");
        mapping1.addPortletName("Portlet 1");
        mapping1.addPortletName("Portlet 2");
        mapping1.addPortletName("Portlet 3");
        FilterMapping mapping2 = app.addFilterMapping("filter-2");
        mapping2.addPortletName("Portlet 1");
        mapping2.addPortletName("Portlet 2");
        mapping2.addPortletName("Portlet 3");
       
        Listener listener1 = app.addListener("org.apache.listener.ListenerOne");
        Description d5 = listener1.addDescription("en");
        d5.setDescription("Listen to me once");
        Description d6 = listener1.addDescription("fr");
View Full Code Here

Examples of org.apache.myfaces.shared_impl.webapp.webxml.FilterMapping

            if (!isFacesExtensionsFilter(filterClass)) {
                continue;
            }
            for (FilterMappingInfo filterMappingInfo : filterInfo.urlMappings) {
                for (String urlPattern : filterMappingInfo.mapping) {
                    facesExtensionsFilterMapppings.add(new FilterMapping(filterInfo.filterName, filterClass, urlPattern));
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.myfaces.shared_tomahawk.webapp.webxml.FilterMapping

        boolean foundMapping = false;
       
        List facesServletMappings = WebXml.getWebXml(extctx).getFacesExtensionsFilterMappings();
        for (Iterator iterServletMappings = facesServletMappings.iterator(); iterServletMappings.hasNext();)
        {
          FilterMapping filterMapping = (FilterMapping) iterServletMappings.next();
          if (checkFilterPattern(extctx, filterMapping))
          {
            foundMapping = true;
            break;
          }
View Full Code Here

Examples of org.apache.openejb.jee.FilterMapping

    @Override
    public void merge(WebFragment webFragment, WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (FilterMapping srcFilterMapping : webFragment.getFilterMapping()) {
            String filterName = srcFilterMapping.getFilterName();
            FilterMapping targetFilterMapping = (FilterMapping) mergeContext.getAttribute(createFilterMappingKey(filterName));
            if (targetFilterMapping == null) {
                webApp.getFilterMapping().add(srcFilterMapping);
                mergeContext.setAttribute(createFilterMappingKey(filterName), srcFilterMapping);
                for (SubMergeHandler<FilterMapping, FilterMapping> subMergeHandler : subMergeHandlers) {
                    subMergeHandler.add(srcFilterMapping, mergeContext);
                }
            } else {
                if (isFilterMappingFromWebXml(filterName, mergeContext)) {
                    continue;
                }
                if (isFilterMappingFromAnnotation(filterName, mergeContext)) {
                    //If the current url-patterns configurations are from annotations, so let's drop them
                    targetFilterMapping.getUrlPattern().clear();
                    targetFilterMapping.getDispatcher().clear();
                    targetFilterMapping.getServletName().clear();
                    mergeContext.removeAttribute(createFilterMappingSourceKey(filterName));
                }
                for (SubMergeHandler<FilterMapping, FilterMapping> subMergeHandler : subMergeHandlers) {
                    subMergeHandler.merge(srcFilterMapping, targetFilterMapping, mergeContext);
                }
View Full Code Here

Examples of org.apache.openejb.jee.FilterMapping

                FilterMergeHandler.addFilter(newFilter, mergeContext);
            }
            //filter-mapping configured in web.xml and web-fragment.xml will override the configurations from annotation
            if (!FilterMappingMergeHandler.isFilterMappingConfigured(filterName, mergeContext)) {
                //create filter-mapping element
                FilterMapping filterMapping = new FilterMapping();
                filterMapping.setFilterName(filterName);
                for (String servletName : webFilter.servletNames()) {
                    filterMapping.getServletName().add(servletName);
                }
                for (DispatcherType dispatcherType : webFilter.dispatcherTypes()) {
                    filterMapping.getDispatcher().add(Dispatcher.fromValue(dispatcherType.name()));
                }
                for (String urlPattern : urlPatterns) {
                    filterMapping.getUrlPattern().add(urlPattern);
                }
                webApp.getFilterMapping().add(filterMapping);
                FilterMappingMergeHandler.addFilterMapping(filterMapping, mergeContext);
                //Set this tag, so that if any following web-fragment.xml has defined the url-patterns explicitly, it could drop the configurations from annotation
                mergeContext.setAttribute(FilterMappingMergeHandler.createFilterMappingSourceKey(filterName), ElementSource.ANNOTATION);
View Full Code Here

Examples of org.broadleafcommerce.openadmin.server.service.persistence.module.criteria.FilterMapping

        BasicFieldMetadata metadata = (BasicFieldMetadata) addSearchMappingRequest.getMergedProperties().get
                (addSearchMappingRequest.getPropertyName());
       
        FilterAndSortCriteria fasc = addSearchMappingRequest.getRequestedCto().get(addSearchMappingRequest.getPropertyName());

        FilterMapping filterMapping = new FilterMapping()
                .withInheritedFromClass(clazz)
                .withFullPropertyName(addSearchMappingRequest.getPropertyName())
                .withFilterValues(fasc.getFilterValues())
                .withSortDirection(fasc.getSortDirection());
        filterMappings.add(filterMapping);
       
        if (fasc.hasSpecialFilterValue()) {
            filterMapping.setDirectFilterValues(new EmptyFilterValues());
           
            // Handle special values on a case by case basis
            List<String> specialValues = fasc.getSpecialFilterValues();
            if (specialValues.contains(FilterAndSortCriteria.IS_NULL_FILTER_VALUE)) {
                filterMapping.setRestriction(new Restriction().withPredicateProvider(new IsNullPredicateProvider()));
            }
            if (specialValues.contains(FilterAndSortCriteria.IS_NOT_NULL_FILTER_VALUE)) {
                filterMapping.setRestriction(new Restriction().withPredicateProvider(new IsNotNullPredicateProvider()));
            }
        } else {
            switch (metadata.getFieldType()) {
            case BOOLEAN:
                if (targetType == null || targetType.equals(Boolean.class) || targetType.equals(boolean.class)) {
                    filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                            (RestrictionType.BOOLEAN.getType(), addSearchMappingRequest.getPropertyName()));
                } else {
                    filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                            (RestrictionType.CHARACTER.getType(), addSearchMappingRequest.getPropertyName()));
                }
                break;
            case DATE:
                filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                        (RestrictionType.DATE.getType(), addSearchMappingRequest.getPropertyName()));
                break;
            case DECIMAL:
            case MONEY:
                filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                        (RestrictionType.DECIMAL.getType(), addSearchMappingRequest.getPropertyName()));
                break;
            case INTEGER:
                filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                        (RestrictionType.LONG.getType(), addSearchMappingRequest.getPropertyName()));
                break;
            case BROADLEAF_ENUMERATION:
                filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction(RestrictionType.STRING_EQUAL.getType(), addSearchMappingRequest.getPropertyName()));
                break;
            default:
                filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                        (RestrictionType.STRING_LIKE.getType(), addSearchMappingRequest.getPropertyName()));
                break;
            case FOREIGN_KEY:
                if (!addSearchMappingRequest.getRequestedCto().get(addSearchMappingRequest.getPropertyName())
                        .getFilterValues().isEmpty()) {
                    ForeignKey foreignKey = (ForeignKey) addSearchMappingRequest.getPersistencePerspective()
                            .getPersistencePerspectiveItems().get
                            (PersistencePerspectiveItemType.FOREIGNKEY);
                    if (metadata.getForeignKeyCollection()) {
                        if (ForeignKeyRestrictionType.COLLECTION_SIZE_EQ.toString().equals(foreignKey
                                .getRestrictionType().toString())) {
                            filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory()
                                    .getRestriction(RestrictionType.COLLECTION_SIZE_EQUAL.getType(),
                                            addSearchMappingRequest.getPropertyName()));
                            filterMapping.setFieldPath(new FieldPath());
                        } else {
                            filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory()
                                    .getRestriction(RestrictionType.LONG.getType(),
                                            addSearchMappingRequest.getPropertyName()));
                            filterMapping.setFieldPath(new FieldPath().withTargetProperty(addSearchMappingRequest
                                    .getPropertyName() + "." + metadata.getForeignKeyProperty()));
                        }
                    } else if (addSearchMappingRequest.getRequestedCto().get(addSearchMappingRequest.getPropertyName())
                            .getFilterValues().get(0) == null || "null".equals(addSearchMappingRequest
                            .getRequestedCto().get
                            (addSearchMappingRequest.getPropertyName()).getFilterValues().get(0))) {
                        filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                                (RestrictionType.IS_NULL_LONG.getType(), addSearchMappingRequest.getPropertyName()));
                    } else if (metadata.getSecondaryType() == SupportedFieldType.STRING) {
                        filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                                (RestrictionType.STRING_EQUAL.getType(), addSearchMappingRequest.getPropertyName()));
                        filterMapping.setFieldPath(new FieldPath().withTargetProperty(addSearchMappingRequest
                                .getPropertyName() + "." + metadata.getForeignKeyProperty()));
                    } else {
                        filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                                (RestrictionType.LONG_EQUAL.getType(), addSearchMappingRequest.getPropertyName()));
                        filterMapping.setFieldPath(new FieldPath().withTargetProperty(addSearchMappingRequest
                                .getPropertyName() + "." + metadata.getForeignKeyProperty()));
                    }
                }
                break;
            case ADDITIONAL_FOREIGN_KEY:
                int additionalForeignKeyIndexPosition = Arrays.binarySearch(addSearchMappingRequest
                    .getPersistencePerspective()
                    .getAdditionalForeignKeys(), new ForeignKey(addSearchMappingRequest.getPropertyName(),
                    null, null),
                    new Comparator<ForeignKey>() {
                        @Override
                        public int compare(ForeignKey o1, ForeignKey o2) {
                            return o1.getManyToField().compareTo(o2.getManyToField());
                        }
                    });
                ForeignKey foreignKey = null;
                if (additionalForeignKeyIndexPosition >= 0) {
                    foreignKey = addSearchMappingRequest.getPersistencePerspective().getAdditionalForeignKeys()[additionalForeignKeyIndexPosition];
                }
                // in the case of a to-one lookup, an explicit ForeignKey is not passed in. The system should then
                // default to just using a ForeignKeyRestrictionType.ID_EQ
                if (metadata.getForeignKeyCollection()) {
                    if (ForeignKeyRestrictionType.COLLECTION_SIZE_EQ.toString().equals(foreignKey
                            .getRestrictionType().toString())) {
                        filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory()
                                .getRestriction(RestrictionType.COLLECTION_SIZE_EQUAL.getType(),
                                        addSearchMappingRequest.getPropertyName()));
                        filterMapping.setFieldPath(new FieldPath());
                    } else {
                        filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction(RestrictionType.LONG.getType(), addSearchMappingRequest.getPropertyName()));
                        filterMapping.setFieldPath(new FieldPath().withTargetProperty(addSearchMappingRequest.getPropertyName() + "." + metadata.getForeignKeyProperty()));
                    }
                } else if (CollectionUtils.isEmpty(addSearchMappingRequest.getRequestedCto().get(addSearchMappingRequest.getPropertyName()).getFilterValues()) ||
                        addSearchMappingRequest.getRequestedCto().get(addSearchMappingRequest.getPropertyName()) .getFilterValues().get(0) == null || "null".equals(addSearchMappingRequest.getRequestedCto().get
                        (addSearchMappingRequest.getPropertyName()).getFilterValues().get(0))) {
                    filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction(RestrictionType.IS_NULL_LONG.getType(), addSearchMappingRequest.getPropertyName()));
                } else if (metadata.getSecondaryType() == SupportedFieldType.STRING) {
                    filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction(RestrictionType.STRING_EQUAL.getType(), addSearchMappingRequest.getPropertyName()));
                    filterMapping.setFieldPath(new FieldPath().withTargetProperty(addSearchMappingRequest.getPropertyName() + "." + metadata.getForeignKeyProperty()));
                } else {
                    filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction(RestrictionType.LONG_EQUAL.getType(), addSearchMappingRequest.getPropertyName()));
                    filterMapping.setFieldPath(new FieldPath().withTargetProperty(addSearchMappingRequest.getPropertyName() + "." + metadata.getForeignKeyProperty()));
                }
                break;
            case ID:
                switch (metadata.getSecondaryType()) {
                    case INTEGER:
                        filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().getRestriction
                                (RestrictionType.LONG_EQUAL.getType(), addSearchMappingRequest.getPropertyName()));
                        break;
                    case STRING:
                        filterMapping.setRestriction(addSearchMappingRequest.getRestrictionFactory().
                                getRestriction(RestrictionType.STRING_EQUAL.getType(),
                                        addSearchMappingRequest.getPropertyName()));
                        break;
                }
                break;
View Full Code Here

Examples of org.codehaus.cargo.module.webapp.elements.FilterMapping

            //filterMappingElement.appendChild(createNestedText(WebXmlTag.URL_PATTERN, urlPattern));
            //addElement(WebXmlTag.FILTER_MAPPING, filterMappingElement, getRootElement());
           
           
            WebXmlTag tag = (WebXmlTag)theWebXml.getDescriptorType().getTagByName("filter-mapping");
            FilterMapping filterMapping = new FilterMapping(tag);
            filterMapping.setName(this.name);
            filterMapping.setUrlPattern(this.mapping);
            filterMapping.setFilterName(this.name);
           
           
            //theWebXml.addTag(filterMapping);
//           
//            theWebXml.addTag(filterM);
View Full Code Here

Examples of org.eclipse.jetty.servlet.FilterMapping

            {
                holder.setInitParameter(ip.name(), ip.value());
                metaData.setOrigin(name+".filter.init-param."+ip.name(),ip,clazz);
            }

            FilterMapping mapping = new FilterMapping();
            mapping.setFilterName(holder.getName());

            if (urlPatterns.length > 0)
            {
                ArrayList<String> paths = new ArrayList<String>();
                for (String s:urlPatterns)
                {
                    paths.add(Util.normalizePattern(s));
                }
                mapping.setPathSpecs(paths.toArray(new String[paths.size()]));
            }

            if (filterAnnotation.servletNames().length > 0)
            {
                ArrayList<String> names = new ArrayList<String>();
                for (String s : filterAnnotation.servletNames())
                {
                    names.add(s);
                }
                mapping.setServletNames(names.toArray(new String[names.size()]));
            }

            EnumSet<DispatcherType> dispatcherSet = EnumSet.noneOf(DispatcherType.class);
            for (DispatcherType d : filterAnnotation.dispatcherTypes())
            {
                dispatcherSet.add(d);
            }
            mapping.setDispatcherTypes(dispatcherSet);
            metaData.setOrigin(name+".filter.mappings",filterAnnotation,clazz);

            holder.setAsyncSupported(filterAnnotation.asyncSupported());
            metaData.setOrigin(name+".filter.async-supported",filterAnnotation,clazz);

            _context.getServletHandler().addFilter(holder);
            _context.getServletHandler().addFilterMapping(mapping);
        }
        else
        {
            //A Filter definition for the same name already exists from web.xml
            //ServletSpec 3.0 p81 if the Filter is already defined and has mappings,
            //they override the annotation. If it already has DispatcherType set, that
            //also overrides the annotation. Init-params are additive, but web.xml overrides
            //init-params of the same name.
            for (WebInitParam ip:  filterAnnotation.initParams())
            {
                //if (holder.getInitParameter(ip.name()) == null)
                if (metaData.getOrigin(name+".filter.init-param."+ip.name())==Origin.NotSet)
                {
                    holder.setInitParameter(ip.name(), ip.value());
                    metaData.setOrigin(name+".filter.init-param."+ip.name(),ip,clazz);
                }
            }

            FilterMapping[] mappings = _context.getServletHandler().getFilterMappings();
            boolean mappingExists = false;
            if (mappings != null)
            {
                for (FilterMapping m:mappings)
                {
                    if (m.getFilterName().equals(name))
                    {
                        mappingExists = true;
                        break;
                    }
                }
            }
            //if a descriptor didn't specify at least one mapping, use the mappings from the annotation and the DispatcherTypes
            //from the annotation
            if (!mappingExists)
            {
                FilterMapping mapping = new FilterMapping();
                mapping.setFilterName(holder.getName());

                if (urlPatterns.length > 0)
                {
                    ArrayList<String> paths = new ArrayList<String>();
                    for (String s:urlPatterns)
                    {
                        paths.add(Util.normalizePattern(s));
                    }
                    mapping.setPathSpecs(paths.toArray(new String[paths.size()]));
                }
                if (filterAnnotation.servletNames().length > 0)
                {
                    ArrayList<String> names = new ArrayList<String>();
                    for (String s : filterAnnotation.servletNames())
                    {
                        names.add(s);
                    }
                    mapping.setServletNames(names.toArray(new String[names.size()]));
                }

                EnumSet<DispatcherType> dispatcherSet = EnumSet.noneOf(DispatcherType.class);
                for (DispatcherType d : filterAnnotation.dispatcherTypes())
                {
                    dispatcherSet.add(d);
                }
                mapping.setDispatcherTypes(dispatcherSet);
                _context.getServletHandler().addFilterMapping(mapping);
                metaData.setOrigin(name+".filter.mappings",filterAnnotation,clazz);
            }
        }
    }
View Full Code Here

Examples of org.eclipse.jst.j2ee.webapplication.FilterMapping

          filter.getInitParams().add(initParam);
        }

        webApp.getFilters().add(filter);

        FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();
        mapping.setServletName(servlet.getServletName());
        mapping.setFilter(filter);
        webApp.getFilterMappings().add(mapping);

        String[] filterPatterns = {"*.css", "*.js", "*.gif", "*.png"};
        for(String pattern: filterPatterns){
          mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();
          mapping.setFilter(filter);
          mapping.setUrlPattern(pattern);
          webApp.getFilterMappings().add(mapping);
        }
      }

      // init mappings
      String[] listOfMappings = {"*.htm"};
      ClickUtils.setUpURLMappings(webApp, listOfMappings, servlet);

      // welcome-file-list
      ClickUtils.createOrUpdateFilelist(webApp);

      // Add Cayenne Support
      if(useCayenne){
        Filter filter = WebapplicationFactory.eINSTANCE.createFilter();
        filter.setFilterClassName(ClickUtils.CAYENNE_FILTER_CLASS);
        filter.setName("DataContextFilter");

        if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
          // J2EE 1.4
          ParamValue initParam = CommonFactory.eINSTANCE.createParamValue();
          initParam.setName("session-scope");
          initParam.setValue("false");
          filter.getInitParamValues().add(initParam);
        } else {
          // J2EE 1.2 or 1.3
          InitParam initParam = WebapplicationFactory.eINSTANCE.createInitParam();
          initParam.setParamName("session-scope");
          initParam.setParamValue("false");
          filter.getInitParams().add(initParam);
        }

        webApp.getFilters().add(filter);

        FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();
        mapping.setServletName(servlet.getServletName());
        mapping.setFilter(filter);
        webApp.getFilterMappings().add(mapping);
      }
    } catch(Exception ex){
      ClickPlugin.log(ex);
    } finally {
View Full Code Here

Examples of org.eclipse.jst.javaee.web.FilterMapping

   
    public static void updateFilterMappings(final WebApp webApp,
            final Filter filter, final String displayName)
    {
        // update mappings for new name
        FilterMapping mapping = findFilterMapping(webApp, filter);
        if (mapping != null)
        {
            mapping.setFilterName(displayName);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.