void webFilter()

in cdi-extension-servlet-common/src/main/java/org/apache/aries/cdi/extension/servlet/common/BaseServletExtension.java [76:120]


	void webFilter(
		@Observes @FiltersOn(annotations = WebFilter.class) ProcessPotentialService pat,
		BeanManager beanManager) {

		beanManager.fireEvent(MergeServiceTypes.forEvent(pat).withTypes(Filter.class).build());

		final AnnotatedTypeConfigurator<?> configurator = pat.configureAnnotatedType();
		final AnnotatedType<?> annotatedType = pat.getAnnotatedType();

		WebFilter webFilter = annotatedType.getAnnotation(WebFilter.class);

		if (!annotatedType.isAnnotationPresent(HttpWhiteboardContextSelect.class)) {
			ofNullable((String) configuration.get(HTTP_WHITEBOARD_CONTEXT_SELECT)).ifPresent(
				select -> configurator.add(HttpWhiteboardContextSelect.Literal.of(select))
			);
		}

		if (!annotatedType.isAnnotationPresent(ServiceDescription.class) && !webFilter.description().isEmpty()) {
			configurator.add(ServiceDescription.Literal.of(webFilter.description()));
		}

		if (!annotatedType.isAnnotationPresent(HttpWhiteboardFilterName.class) && !webFilter.filterName().isEmpty()) {
			configurator.add(HttpWhiteboardFilterName.Literal.of(webFilter.filterName()));
		}

		if (!annotatedType.isAnnotationPresent(HttpWhiteboardFilterServlet.class) && webFilter.servletNames().length > 0) {
			configurator.add(HttpWhiteboardFilterServlet.Literal.of(webFilter.servletNames()));
		}

		if (!annotatedType.isAnnotationPresent(HttpWhiteboardFilterPattern.class)) {
			if (webFilter.value().length > 0) {
				configurator.add(HttpWhiteboardFilterPattern.Literal.of(webFilter.value()));
			} else if (webFilter.urlPatterns().length > 0) {
				configurator.add(HttpWhiteboardFilterPattern.Literal.of(webFilter.urlPatterns()));
			}
		}

		if (!annotatedType.isAnnotationPresent(HttpWhiteboardFilterDispatcher.class) && webFilter.dispatcherTypes().length > 0) {
			configurator.add(HttpWhiteboardFilterDispatcher.Literal.of(webFilter.dispatcherTypes()));
		}

		if (!annotatedType.isAnnotationPresent(HttpWhiteboardFilterAsyncSupported.class)) {
			configurator.add(HttpWhiteboardFilterAsyncSupported.Literal.of(webFilter.asyncSupported()));
		}
	}