Package org.apache.openejb.jee

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


                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

TOP

Related Classes of org.apache.openejb.jee.FilterMapping

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.