Examples of urlPatterns()


Examples of javax.servlet.annotation.WebFilter.urlPatterns()

    else
    {
      WebFilter filter = getClass().getAnnotation(WebFilter.class);
      if (filter != null)
      {
        if (filter.urlPatterns().length > 0)
        {
          patterns = filter.urlPatterns();
        }
        else
        {
View Full Code Here

Examples of javax.servlet.annotation.WebFilter.urlPatterns()

      WebFilter filter = getClass().getAnnotation(WebFilter.class);
      if (filter != null)
      {
        if (filter.urlPatterns().length > 0)
        {
          patterns = filter.urlPatterns();
        }
        else
        {
          patterns = filter.value();
        }
View Full Code Here

Examples of javax.servlet.annotation.WebFilter.urlPatterns()

                filterDef.addInitParameter(params[i].name(), params[i].value());
            }
            context.addFilterDef(filterDef);
            FilterMap filterMap = new FilterMap();
            filterMap.setFilterName(filterName);
            String[] urlPatterns = annotation.urlPatterns();
            if (urlPatterns != null) {
                for (int i = 0; i < urlPatterns.length; i++) {
                    filterMap.addURLPattern(urlPatterns[i]);
                }
            }
View Full Code Here

Examples of javax.servlet.annotation.WebFilter.urlPatterns()

            WebInitParam[] params = annotation.initParams();
            for (int i = 0; i < params.length; i++) {
                wrapper.addInitParameter(params[i].name(), params[i].value());
            }
            context.addChild(wrapper);
            String[] urlPatterns = annotation.urlPatterns();
            if (urlPatterns != null) {
                for (int i = 0; i < urlPatterns.length; i++) {
                    context.addServletMapping(urlPatterns[i], annotation.name());
                }
            }
View Full Code Here

Examples of javax.servlet.annotation.WebFilter.urlPatterns()

                throw new DeploymentException("The class " + cls.getName() + " with WebFilter annotation must implement javax.servlet.Filter");
            }
            WebFilter webFilter = cls.getAnnotation(WebFilter.class);
            String filterName = webFilter.filterName().length() == 0 ? cls.getName() : webFilter.filterName();
            boolean valueAttributeConfigured = webFilter.value().length > 0;
            boolean urlPatternsAttributeConfigured = webFilter.urlPatterns().length > 0;
            if (valueAttributeConfigured && urlPatternsAttributeConfigured) {
                throw new DeploymentException("value and urlPatterns must not be configured on the same WebFilter annotation in the class " + cls.getName());
            }
            boolean servletNamesAttributeConfigured = webFilter.servletNames().length == 0;
            if (!valueAttributeConfigured && !urlPatternsAttributeConfigured && !servletNamesAttributeConfigured) {
View Full Code Here

Examples of javax.servlet.annotation.WebFilter.urlPatterns()

            }
            boolean servletNamesAttributeConfigured = webFilter.servletNames().length == 0;
            if (!valueAttributeConfigured && !urlPatternsAttributeConfigured && !servletNamesAttributeConfigured) {
                throw new DeploymentException("At least one of value, urlPatterns and servletNames attributes are configured on the WebFilter annotation in the class " + cls.getName());
            }
            String[] urlPatterns = valueAttributeConfigured ? webFilter.value() : webFilter.urlPatterns();
            if (FilterMergeHandler.isFilterConfigured(filterName, mergeContext)) {
                //merge the filter annotation configuration to current web.xml
                org.apache.openejb.jee.Filter targetFilter = FilterMergeHandler.getFilter(filterName, mergeContext);
                //merge init-param
                for (WebInitParam webInitParam : webFilter.initParams()) {
View Full Code Here

Examples of javax.servlet.annotation.WebFilter.urlPatterns()

                        for (final WebInitParam param : annotation.initParams()) {
                            initParams.put(param.name(), param.value());
                        }

                        final FilterConfig config = new SimpleFilterConfig(sce.getServletContext(), info.name, initParams);
                        for (final String mapping : annotation.urlPatterns()) {
                            try {
                                addFilterMethod.invoke(null, clazz.getName(), webContext, mapping, config);
                                deployedWebObjects.filterMappings.add(mapping);
                            } catch (final Exception e) {
                                LOGGER.warning(e.getMessage(), e);
View Full Code Here

Examples of javax.servlet.annotation.WebFilter.urlPatterns()

                final String url = info.name;
                for (final String servletPath : info.list) {
                    final Class<?> clazz = loadFromUrls(webContext.getClassLoader(), url, servletPath);
                    final WebServlet annotation = clazz.getAnnotation(WebServlet.class);
                    if (annotation != null) {
                        for (final String mapping : annotation.urlPatterns()) {
                            try {
                                addServletMethod.invoke(null, clazz.getName(), webContext, mapping);
                                deployedWebObjects.mappings.add(mapping);
                            } catch (final Exception e) {
                                LOGGER.warning(e.getMessage(), e);
View Full Code Here

Examples of javax.servlet.annotation.WebFilter.urlPatterns()

                throw new DeploymentException("The class " + cls.getName() + " with WebFilter annotation must implement javax.servlet.Filter");
            }
            WebFilter webFilter = cls.getAnnotation(WebFilter.class);
            String filterName = webFilter.filterName().length() == 0 ? cls.getName() : webFilter.filterName();
            boolean valueAttributeConfigured = webFilter.value().length > 0;
            boolean urlPatternsAttributeConfigured = webFilter.urlPatterns().length > 0;
            if (valueAttributeConfigured && urlPatternsAttributeConfigured) {
                throw new DeploymentException("value and urlPatterns must not be configured on the same WebFilter annotation in the class " + cls.getName());
            }
            boolean servletNamesAttributeConfigured = webFilter.servletNames().length == 0;
            if (!valueAttributeConfigured && !urlPatternsAttributeConfigured && !servletNamesAttributeConfigured) {
View Full Code Here

Examples of javax.servlet.annotation.WebFilter.urlPatterns()

            }
            boolean servletNamesAttributeConfigured = webFilter.servletNames().length == 0;
            if (!valueAttributeConfigured && !urlPatternsAttributeConfigured && !servletNamesAttributeConfigured) {
                throw new DeploymentException("At least one of value, urlPatterns and servletNames attributes are configured on the WebFilter annotation in the class " + cls.getName());
            }
            String[] urlPatterns = valueAttributeConfigured ? webFilter.value() : webFilter.urlPatterns();
            if (FilterMergeHandler.isFilterConfigured(filterName, mergeContext)) {
                //merge the filter annotation configuration to current web.xml
                FilterType targetFilter = FilterMergeHandler.getFilter(filterName, mergeContext);
                //merge init-param
                for (WebInitParam webInitParam : webFilter.initParams()) {
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.