Merge pull request #37 from rotty3000/master
simplify by auto resolving tests
diff --git a/cdi-executable/owb-executable.bndrun b/cdi-executable/owb-executable.bndrun
index 69530e0..b2af497 100644
--- a/cdi-executable/owb-executable.bndrun
+++ b/cdi-executable/owb-executable.bndrun
@@ -25,6 +25,7 @@
openwebbeans-spi;version='[2.0.13,2.0.14)',\
org.apache.aries.cdi.extender;version='[1.1.0,1.1.1)',\
org.apache.aries.cdi.extension.spi;version='[1.1.0,1.1.1)',\
+ org.apache.aries.cdi.owb;version='[1.1.0,1.1.1)',\
org.apache.aries.cdi.spi;version='[1.1.0,1.1.1)',\
org.apache.aries.spifly.dynamic.framework.extension;version='[1.2.3,1.2.4)',\
org.apache.felix.configadmin;version='[1.9.10,1.9.11)',\
@@ -42,5 +43,4 @@
org.apache.xbean.finder-shaded;version='[4.13.0,4.13.1)',\
org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
org.osgi.util.function;version='[1.1.0,1.1.1)',\
- org.osgi.util.promise;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.owb;version='[1.1.0,1.1.1)'
+ org.osgi.util.promise;version='[1.1.0,1.1.1)'
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerBootstrap.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerBootstrap.java
index 2d0b8d1..4771a27 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerBootstrap.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerBootstrap.java
@@ -186,9 +186,9 @@
Maps.of(Constants.SERVICE_ID, counter.decrementAndGet(),
Constants.SERVICE_DESCRIPTION, "Aries CDI LoggerExtension"));
initializer.addExtension(
- new ServiceAdapterExtension(),
- Maps.of(Constants.SERVICE_ID, counter.decrementAndGet(),
- Constants.SERVICE_DESCRIPTION, "Aries CDI ServiceAdapterExtension"));
+ new ServiceAdapterExtension(),
+ Maps.of(Constants.SERVICE_ID, counter.decrementAndGet(),
+ Constants.SERVICE_DESCRIPTION, "Aries CDI ServiceAdapterExtension"));
// Add extensions found from the bundle's class loader, such as those in the Bundle-ClassPath
ServiceLoader.load(Extension.class, containerState.classLoader()).forEach(extension ->
@@ -265,4 +265,4 @@
private final Logger _log;
private final ServiceTracker<ContainerListener, ContainerListener> _listeners;
-}
\ No newline at end of file
+}
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java
index f0474f2..0842a0e 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java
@@ -3,7 +3,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
-* http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ServiceAdapterExtension.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ServiceAdapterExtension.java
index ca3dc47..0424ae1 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ServiceAdapterExtension.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ServiceAdapterExtension.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,6 +35,7 @@
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterDeploymentValidation;
import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedCallable;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.Extension;
@@ -62,19 +63,19 @@
// declarative mode
forwardingObservers.addAll(forMethods(registerExtension.getExtension().getClass())
- .map(method -> new SimpleImmutableEntry<>(registerExtension.getExtension(), method))
- .filter(method -> Stream.of(method.getValue().getParameters())
- .anyMatch(p -> p.isAnnotationPresent(Observes.class) && p.getType() == ProcessPotentialService.class))
- .map(e -> new SimpleImmutableEntry<>(toPredicate(e.getValue()), toConsumer(e.getValue(), e.getKey())))
- .collect(toList()));
+ .map(method -> new SimpleImmutableEntry<>(registerExtension.getExtension(), method))
+ .filter(method -> Stream.of(method.getValue().getParameters())
+ .anyMatch(p -> p.isAnnotationPresent(Observes.class) && p.getType() == ProcessPotentialService.class))
+ .map(e -> new SimpleImmutableEntry<>(toPredicate(e.getValue()), toConsumer(e.getValue(), e.getKey())))
+ .collect(toList()));
// functional mode
forwardingObservers.addAll(registerExtension.getBuilders().stream()
- .map(builder -> new SimpleImmutableEntry<>(
- toPredicate(builder.getAnnotations(), builder.getTypes()),
- (BiConsumer<BeanManager, ProcessAnnotatedType<?>>) (bm, pat) ->
- builder.getConsumer().accept(bm, new ProcessPotentialService(pat))))
- .collect(toList()));
+ .map(builder -> new SimpleImmutableEntry<>(
+ toPredicate(builder.getAnnotations(), builder.getTypes()),
+ (BiConsumer<BeanManager, ProcessAnnotatedType<?>>) (bm, pat) ->
+ builder.getConsumer().accept(bm, new ProcessPotentialService(pat))))
+ .collect(toList()));
}
<T> void forwardToObservers(@Observes final ProcessAnnotatedType<T> pat, final BeanManager beanManager) {
@@ -84,9 +85,9 @@
// beanManager.fireEvent(new ProcessPotentialService(pat), createAllPotentialQualifiers(pat));
forwardingObservers.stream()
- .filter(predicateWithObserver -> predicateWithObserver.getKey().test(annotatedType))
- .map(Entry::getValue)
- .forEach(observer -> observer.accept(beanManager, pat));
+ .filter(predicateWithObserver -> predicateWithObserver.getKey().test(annotatedType))
+ .map(Entry::getValue)
+ .forEach(observer -> observer.accept(beanManager, pat));
}
}
@@ -95,19 +96,19 @@
throw new IllegalStateException("Container already started");
}
- final AdaptedService adaptedService = mergeServiceTypes.getProcessAnnotatedType()
- .getAnnotatedType().getAnnotation(AdaptedService.class);
+ final AdaptedService adaptedService = mergeServiceTypes.getProcessAnnotatedType().getAnnotatedType().getAnnotation(AdaptedService.class);
final AnnotatedTypeConfigurator<?> configurator = mergeServiceTypes.getProcessAnnotatedType().configureAnnotatedType();
final Class<?>[] services;
if (adaptedService != null) {
configurator.remove(a -> a.annotationType() == AdaptedService.class);
services = Stream.concat(
- Stream.of(mergeServiceTypes.getTypes()),
- Stream.of(adaptedService.value()))
- .distinct()
- .toArray(Class[]::new);
- } else {
+ Stream.of(mergeServiceTypes.getTypes()),
+ Stream.of(adaptedService.value()))
+ .distinct()
+ .toArray(Class[]::new);
+ }
+ else {
services = mergeServiceTypes.getTypes();
}
configurator.add(AdaptedService.Literal.of(services));
@@ -120,11 +121,11 @@
// using reflection since we are too early in CDI lifecycle to use CDI model
private Predicate<AnnotatedType<?>> toPredicate(final Method method) {
return Stream.of(method.getParameters())
- .filter(parameter -> parameter.isAnnotationPresent(Observes.class))
- .findFirst()
- .map(parameter -> parameter.getAnnotation(FiltersOn.class))
- .map(filters -> toPredicate(asList(filters.annotations()), asList(filters.types())))
- .orElse(ANNOTATED_TYPE_TRUE_PREDICATE);
+ .filter(parameter -> parameter.isAnnotationPresent(Observes.class))
+ .findFirst()
+ .map(parameter -> parameter.getAnnotation(FiltersOn.class))
+ .map(filters -> toPredicate(asList(filters.annotations()), asList(filters.types())))
+ .orElse(ANNOTATED_TYPE_TRUE_PREDICATE);
}
private Predicate<AnnotatedType<?>> toPredicate(final Collection<Class<?>> annotations, final Collection<Class<?>> types) {
@@ -132,20 +133,23 @@
}
private BiConsumer<BeanManager, ProcessAnnotatedType<?>> toConsumer(final Method method, final Extension instance) {
+ @SuppressWarnings("unchecked")
final BiFunction<BeanManager, ProcessAnnotatedType<?>, Object>[] argsFactory = Stream.of(method.getParameters())
- .map(parameter -> lookupMethod(method, parameter))
- .toArray(BiFunction[]::new);
+ .map(parameter -> lookupMethod(method, parameter))
+ .toArray(BiFunction[]::new);
if (!method.isAccessible()) {
method.setAccessible(true);
}
return (bm, pat) -> {
try {
method.invoke(
- instance,
- Stream.of(argsFactory).map(fn -> fn.apply(bm, pat)).toArray(Object[]::new));
- } catch (final IllegalAccessException e) {
+ instance,
+ Stream.of(argsFactory).map(fn -> fn.apply(bm, pat)).toArray(Object[]::new));
+ }
+ catch (final IllegalAccessException e) {
throw new IllegalStateException(e);
- } catch (final InvocationTargetException e) {
+ }
+ catch (final InvocationTargetException e) {
throw new IllegalStateException(e.getTargetException());
}
};
@@ -160,36 +164,39 @@
return (bm, pat) -> new ProcessPotentialService(pat);
}
throw new IllegalArgumentException(
- "Unsupported type: " + parameter.getType() + " on " + method);
+ "Unsupported type: " + parameter.getType() + " on " + method);
}
private Predicate<AnnotatedType<?>> filterWithTypes(final Collection<Class<?>> filterOnTypes) {
return Optional.of(filterOnTypes)
- .filter(this::shouldNotIgnore)
- .map(types -> (Predicate<AnnotatedType<?>>) annotatedType -> types.stream()
- .anyMatch(t -> annotatedType.getJavaClass().isAssignableFrom(t)))
- .orElse(ANNOTATED_TYPE_TRUE_PREDICATE);
+ .filter(this::shouldNotIgnore)
+ .map(types -> (Predicate<AnnotatedType<?>>) annotatedType -> types.stream()
+ .anyMatch(t -> annotatedType.getJavaClass().isAssignableFrom(t)))
+ .orElse(ANNOTATED_TYPE_TRUE_PREDICATE);
}
private Predicate<AnnotatedType<?>> filterWithAnnotations(final Collection<Class<?>> filterOnAnnotations) {
return Optional.of(filterOnAnnotations)
- .filter(this::shouldNotIgnore)
- .map(withAnnotations -> (Predicate<AnnotatedType<?>>) annotatedType -> Stream.of(
- Stream.of(annotatedType.getAnnotations()), // class
- annotatedType.getFields().stream().map(Annotated::getAnnotations), // fields
- Stream.concat( // (constructors + methods) x (self + parameters)
- annotatedType.getMethods().stream(),
- annotatedType.getConstructors().stream())
- .flatMap(m -> Stream.concat(
- Stream.of(m.getAnnotations()),
- m.getParameters().stream().map(Annotated::getAnnotations))))
- .flatMap(identity())
- .anyMatch(annotations -> annotations.stream().anyMatch(annotation ->
- withAnnotations.stream().anyMatch(withAnnotation -> Stream.concat(
- Stream.of(annotation.annotationType()),
- Stream.of(annotation.annotationType().getAnnotations()).map(Annotation::annotationType))
- .anyMatch(withAnnotation::isAssignableFrom)))))
- .orElse(ANNOTATED_TYPE_TRUE_PREDICATE);
+ .filter(this::shouldNotIgnore)
+ .map(withAnnotations -> (Predicate<AnnotatedType<?>>) annotatedType -> Stream.of(
+ Stream.of(annotatedType.getAnnotations()), // class
+ annotatedType.getFields().stream().map(Annotated::getAnnotations), // fields
+ Stream.concat( // (constructors + methods) x (self + parameters)
+ (Stream<? extends AnnotatedCallable<?>>)annotatedType.getMethods().stream(),
+ (Stream<? extends AnnotatedCallable<?>>)annotatedType.getConstructors().stream()
+ ).flatMap(m -> Stream.concat(
+ Stream.of(m.getAnnotations()),
+ m.getParameters().stream().map(Annotated::getAnnotations))
+ )
+ ).flatMap(identity()).anyMatch(
+ annotations -> annotations.stream().anyMatch(annotation ->
+ withAnnotations.stream().anyMatch(withAnnotation -> Stream.concat(
+ Stream.of(annotation.annotationType()),
+ Stream.of(annotation.annotationType().getAnnotations()).map(Annotation::annotationType))
+ .anyMatch(withAnnotation::isAssignableFrom))
+ )
+ )
+ ).orElse(ANNOTATED_TYPE_TRUE_PREDICATE);
}
private boolean shouldNotIgnore(final Collection<Class<?>> annotations) {
@@ -198,7 +205,9 @@
private Stream<Method> forMethods(final Class<?> clazz) {
return clazz == Object.class || clazz == null ?
- Stream.empty() :
- Stream.concat(Stream.of(clazz.getDeclaredMethods()), forMethods(clazz.getSuperclass()));
+ Stream.empty() :
+ Stream.concat(Stream.of(clazz.getDeclaredMethods()), forMethods(clazz.getSuperclass()));
}
+
}
+
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/provider/SeContainerInitializer.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/provider/SeContainerInitializer.java
index 48e4edf..1c33bf4 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/provider/SeContainerInitializer.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/provider/SeContainerInitializer.java
@@ -3,7 +3,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
-* http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/spi/ContainerListener.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/spi/ContainerListener.java
index dc2a8e8..ba99bdc 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/spi/ContainerListener.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/spi/ContainerListener.java
@@ -3,7 +3,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
-* http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/cdi-extension-jaxrs/src/main/java/org/apache/aries/cdi/extension/jaxrs/JaxrsCDIExtension.java b/cdi-extension-jaxrs/src/main/java/org/apache/aries/cdi/extension/jaxrs/JaxrsCDIExtension.java
index 7b92941..5fad41b 100644
--- a/cdi-extension-jaxrs/src/main/java/org/apache/aries/cdi/extension/jaxrs/JaxrsCDIExtension.java
+++ b/cdi-extension-jaxrs/src/main/java/org/apache/aries/cdi/extension/jaxrs/JaxrsCDIExtension.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -81,8 +81,8 @@
}
void application(
- @Observes @FiltersOn(annotations = ApplicationPath.class)
- ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(annotations = ApplicationPath.class)
+ ProcessPotentialService pat, BeanManager beanManager) {
AnnotatedType<?> annotatedType = pat.getAnnotatedType();
@@ -91,15 +91,15 @@
commonProperties(pat, Application.class, true, beanManager);
if (!annotatedType.isAnnotationPresent(JaxrsApplicationBase.class)) {
pat.configureAnnotatedType().add(
- JaxrsApplicationBase.Literal.of(
- annotatedType.getAnnotation(ApplicationPath.class).value()));
+ JaxrsApplicationBase.Literal.of(
+ annotatedType.getAnnotation(ApplicationPath.class).value()));
}
}
void resource(
- @Observes
- @FiltersOn(annotations = {Path.class, DELETE.class, GET.class, HEAD.class, OPTIONS.class, PATCH.class, POST.class, PUT.class})
- ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes
+ @FiltersOn(annotations = {Path.class, DELETE.class, GET.class, HEAD.class, OPTIONS.class, PATCH.class, POST.class, PUT.class})
+ ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, Object.class, false, beanManager);
if (!pat.getAnnotatedType().isAnnotationPresent(JaxrsResource.class)) {
@@ -108,27 +108,28 @@
}
void containerRequestFilter(
- @Observes @FiltersOn(types = ContainerRequestFilter.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = ContainerRequestFilter.class) ProcessPotentialService pat, BeanManager beanManager) {
+
commonProperties(pat, ContainerRequestFilter.class, false, beanManager);
addJaxRsExtension(pat);
}
void containerResponseFilter(
- @Observes @FiltersOn(types = ContainerResponseFilter.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = ContainerResponseFilter.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, ContainerResponseFilter.class, false, beanManager);
addJaxRsExtension(pat);
}
void readerInterceptor(
- @Observes @FiltersOn(types = ReaderInterceptor.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = ReaderInterceptor.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, ReaderInterceptor.class, false, beanManager);
addJaxRsExtension(pat);
}
void writerInterceptor(
- @Observes @FiltersOn(types = WriterInterceptor.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = WriterInterceptor.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, WriterInterceptor.class, false, beanManager);
addJaxRsExtension(pat);
@@ -136,7 +137,7 @@
@SuppressWarnings("rawtypes")
void messageBodyReader(
- @Observes @FiltersOn(types = MessageBodyReader.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = MessageBodyReader.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, MessageBodyReader.class, false, beanManager);
addJaxRsExtension(pat);
@@ -144,7 +145,7 @@
@SuppressWarnings("rawtypes")
void messageBodyWriter(
- @Observes @FiltersOn(types = MessageBodyWriter.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = MessageBodyWriter.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, MessageBodyWriter.class, false, beanManager);
addJaxRsExtension(pat);
@@ -152,7 +153,7 @@
@SuppressWarnings("rawtypes")
void contextResolver(
- @Observes @FiltersOn(types = ContextResolver.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = ContextResolver.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, ContextResolver.class, false, beanManager);
addJaxRsExtension(pat);
@@ -160,28 +161,28 @@
@SuppressWarnings("rawtypes")
void exceptionMapper(
- @Observes @FiltersOn(types = ExceptionMapper.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = ExceptionMapper.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, ExceptionMapper.class, false, beanManager);
addJaxRsExtension(pat);
}
void paramConverterProvider(
- @Observes @FiltersOn(types = ParamConverterProvider.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = ParamConverterProvider.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, ParamConverterProvider.class, false, beanManager);
addJaxRsExtension(pat);
}
void feature(
- @Observes @FiltersOn(types = Feature.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = Feature.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, Feature.class, false, beanManager);
addJaxRsExtension(pat);
}
void dynamicFeature(
- @Observes @FiltersOn(types = DynamicFeature.class) ProcessPotentialService pat, BeanManager beanManager) {
+ @Observes @FiltersOn(types = DynamicFeature.class) ProcessPotentialService pat, BeanManager beanManager) {
commonProperties(pat, DynamicFeature.class, false, beanManager);
addJaxRsExtension(pat);
@@ -197,32 +198,36 @@
* @return true if common properties were added (i.e. if no @Service was found)
*/
private void commonProperties(
- ProcessPotentialService pat, Class<?> serviceType, boolean application, BeanManager beanManager) {
+ ProcessPotentialService pat, Class<?> serviceType, boolean application, BeanManager beanManager) {
+
beanManager.fireEvent(MergeServiceTypes.forEvent(pat).withTypes(serviceType).build());
+
final AnnotatedTypeConfigurator<?> configurator = pat.configureAnnotatedType();
final AnnotatedType<?> annotatedType = pat.getAnnotatedType();
+
if (!annotatedType.isAnnotationPresent(JaxrsName.class)) {
if (application) {
configurator.add(
- JaxrsName.Literal.of(
- ofNullable((String) configuration.get(JaxrsWhiteboardConstants.JAX_RS_NAME)).orElse(
- JaxrsWhiteboardConstants.JAX_RS_DEFAULT_APPLICATION
- )
+ JaxrsName.Literal.of(
+ ofNullable((String)configuration.get(JaxrsWhiteboardConstants.JAX_RS_NAME)).orElse(
+ JaxrsWhiteboardConstants.JAX_RS_DEFAULT_APPLICATION
)
+ )
);
- } else {
+ }
+ else {
configurator.add(JaxrsName.Literal.of(annotatedType.getJavaClass().getSimpleName()));
}
}
if (!application && !annotatedType.isAnnotationPresent(JaxrsApplicationSelect.class)) {
- ofNullable((String) configuration.get(JaxrsWhiteboardConstants.JAX_RS_APPLICATION_SELECT)).ifPresent(
- select -> configurator.add(JaxrsApplicationSelect.Literal.of(select))
+ ofNullable((String)configuration.get(JaxrsWhiteboardConstants.JAX_RS_APPLICATION_SELECT)).ifPresent(
+ select -> configurator.add(JaxrsApplicationSelect.Literal.of(select))
);
}
if (!annotatedType.isAnnotationPresent(JaxrsExtensionSelect.class)) {
- ofNullable((String[]) configuration.get(JaxrsWhiteboardConstants.JAX_RS_EXTENSION_SELECT)).ifPresent(selects -> {
+ ofNullable((String[])configuration.get(JaxrsWhiteboardConstants.JAX_RS_EXTENSION_SELECT)).ifPresent(selects -> {
if (selects.length > 0) {
configurator.add(JaxrsExtensionSelect.Literal.of(selects));
}
@@ -230,8 +235,8 @@
}
if (!annotatedType.isAnnotationPresent(JaxrsWhiteboardTarget.class)) {
- ofNullable((String) configuration.get(JaxrsWhiteboardConstants.JAX_RS_WHITEBOARD_TARGET)).ifPresent(
- target -> configurator.add(JaxrsWhiteboardTarget.Literal.of(target))
+ ofNullable((String)configuration.get(JaxrsWhiteboardConstants.JAX_RS_WHITEBOARD_TARGET)).ifPresent(
+ target -> configurator.add(JaxrsWhiteboardTarget.Literal.of(target))
);
}
@@ -245,10 +250,10 @@
}
void afterDeploymentValidation(@Observes AfterDeploymentValidation adv) {
- if (applications.size() > 1) { // todo: revise that, it is not illegal and supported by cxf-cdi-extension
- adv.addDeploymentProblem(
- new DeploymentException(
- "More than one javax.ws.rs.core.Application annotated types were found in the CDI bundle."));
+ if (applications.size() > 1) {
+ // adv.addDeploymentProblem(
+ // new DeploymentException(
+ // "More than one javax.ws.rs.core.Application annotated types were found in the CDI bundle."));
}
}
diff --git a/cdi-extension-mp-config/owb-itest.bndrun b/cdi-extension-mp-config/owb-itest.bndrun
index 151611e..0d26e61 100644
--- a/cdi-extension-mp-config/owb-itest.bndrun
+++ b/cdi-extension-mp-config/owb-itest.bndrun
@@ -18,35 +18,3 @@
-runblacklist: \
osgi.identity;filter:='(osgi.identity=*weld*)'
-
--runbundles: \
- openwebbeans-impl;version='[2.0.13,2.0.14)',\
- openwebbeans-spi;version='[2.0.13,2.0.14)',\
- org.apache.aries.cdi.extender;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-config-tests;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-config;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.owb.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.owb.core;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.spifly.dynamic.framework.extension;version='[1.2.3,1.2.4)',\
- org.apache.felix.configadmin;version='[1.9.10,1.9.11)',\
- org.apache.felix.converter;version='[1.0.12,1.0.13)',\
- org.apache.felix.gogo.command;version='[1.1.0,1.1.1)',\
- org.apache.felix.gogo.runtime;version='[1.1.2,1.1.3)',\
- org.apache.felix.gogo.shell;version='[1.1.2,1.1.3)',\
- org.apache.geronimo.specs.geronimo-annotation_1.3_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-atinject_1.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-el_2.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-interceptor_1.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jcdi_2.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.servicemix.bundles.junit;version='[4.12.0,4.12.1)',\
- org.apache.xbean.asm7-shaded;version='[4.13.0,4.13.1)',\
- org.apache.xbean.bundleutils;version='[4.15.0,4.15.1)',\
- org.apache.xbean.finder-shaded;version='[4.13.0,4.13.1)',\
- org.assertj.core;version='[3.13.2,3.13.3)',\
- org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
- org.osgi.test.common;version='[1.0.0,1.0.1)',\
- org.osgi.test.junit4;version='[1.0.0,1.0.1)',\
- org.osgi.util.function;version='[1.1.0,1.1.1)',\
- org.osgi.util.promise;version='[1.1.0,1.1.1)'
diff --git a/cdi-extension-mp-config/pom.xml b/cdi-extension-mp-config/pom.xml
index 0c62b97..1e4e0a7 100644
--- a/cdi-extension-mp-config/pom.xml
+++ b/cdi-extension-mp-config/pom.xml
@@ -250,50 +250,6 @@
</execution>
</executions>
</plugin>
- <!-- This dynamically calculates all the things we need to run our code. -->
- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-resolver-maven-plugin</artifactId>
- <configuration>
- <bundles>
- <bundle>target/${project.build.finalName}-tests.jar</bundle>
- </bundles>
- <failOnChanges>false</failOnChanges>
- <includeDependencyManagement>true</includeDependencyManagement>
- <reportOptional>false</reportOptional>
- <scopes>
- <scope>compile</scope>
- <scope>runtime</scope>
- <scope>test</scope>
- </scopes>
- </configuration>
- <executions>
- <execution>
- <id>resolve-test-owb</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <bndruns>
- <bndrun>owb-itest.bndrun</bndrun>
- </bndruns>
- </configuration>
- </execution>
- <execution>
- <id>resolve-test-weld</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <bndruns>
- <bndrun>weld-itest.bndrun</bndrun>
- </bndruns>
- </configuration>
- </execution>
- </executions>
- </plugin>
<!-- This is the plugin runs the OSGi integration tests. -->
<plugin>
<groupId>biz.aQute.bnd</groupId>
@@ -304,7 +260,7 @@
</bundles>
<failOnChanges>false</failOnChanges>
<includeDependencyManagement>true</includeDependencyManagement>
- <resolve>false</resolve>
+ <resolve>true</resolve>
<scopes>
<scope>compile</scope>
<scope>runtime</scope>
@@ -336,41 +292,6 @@
</execution>
</executions>
</plugin>
- <!-- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-run-maven-plugin</artifactId>
- <configuration>
- <bundles>
- <bundle>target/${project.build.finalName}-tests.jar</bundle>
- </bundles>
- <includeDependencyManagement>true</includeDependencyManagement>
- <scopes>
- <scope>compile</scope>
- <scope>runtime</scope>
- <scope>test</scope>
- </scopes>
- </configuration>
- <executions>
- <execution>
- <id>run-owb</id>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <bndrun>owb-itest.bndrun</bndrun>
- </configuration>
- </execution>
- <execution>
- <id>run-weld</id>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <bndrun>weld-itest.bndrun</bndrun>
- </configuration>
- </execution>
- </executions>
- </plugin> -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
diff --git a/cdi-extension-mp-config/weld-itest.bndrun b/cdi-extension-mp-config/weld-itest.bndrun
index bb1b6fb..a7025c4 100644
--- a/cdi-extension-mp-config/weld-itest.bndrun
+++ b/cdi-extension-mp-config/weld-itest.bndrun
@@ -19,34 +19,3 @@
-runblacklist: \
osgi.identity;filter:='(osgi.identity=*owb*)'
-
--runbundles: \
- jboss-classfilewriter;version='[1.2.4,1.2.5)',\
- org.apache.aries.cdi.extender;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-config-tests;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-config;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.weld;version='[1.1.0,1.1.1)',\
- org.apache.aries.spifly.dynamic.framework.extension;version='[1.2.3,1.2.4)',\
- org.apache.felix.configadmin;version='[1.9.10,1.9.11)',\
- org.apache.felix.converter;version='[1.0.12,1.0.13)',\
- org.apache.felix.gogo.command;version='[1.1.0,1.1.1)',\
- org.apache.felix.gogo.runtime;version='[1.1.2,1.1.3)',\
- org.apache.felix.gogo.shell;version='[1.1.2,1.1.3)',\
- org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
- org.apache.geronimo.specs.geronimo-annotation_1.3_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-atinject_1.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-el_2.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-interceptor_1.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jcdi_2.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.servicemix.bundles.junit;version='[4.12.0,4.12.1)',\
- org.assertj.core;version='[3.13.2,3.13.3)',\
- org.jboss.logging.jboss-logging;version='[3.3.2,3.3.3)',\
- org.jboss.spec.javax.ejb.jboss-ejb-api_3.2_spec;version='[2.0.0,2.0.1)',\
- org.jboss.weld.osgi-bundle;version='[3.1.3,3.1.4)',\
- org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
- org.osgi.test.common;version='[1.0.0,1.0.1)',\
- org.osgi.test.junit4;version='[1.0.0,1.0.1)',\
- org.osgi.util.function;version='[1.1.0,1.1.1)',\
- org.osgi.util.promise;version='[1.1.0,1.1.1)'
diff --git a/cdi-extension-mp-jwt-auth/owb-itest.bndrun b/cdi-extension-mp-jwt-auth/owb-itest.bndrun
index e3fcbf7..0d26e61 100644
--- a/cdi-extension-mp-jwt-auth/owb-itest.bndrun
+++ b/cdi-extension-mp-jwt-auth/owb-itest.bndrun
@@ -18,57 +18,3 @@
-runblacklist: \
osgi.identity;filter:='(osgi.identity=*weld*)'
-
--runbundles: \
- javax.servlet.jsp-api;version='[2.3.3,2.3.4)',\
- openwebbeans-impl;version='[2.0.13,2.0.14)',\
- openwebbeans-spi;version='[2.0.13,2.0.14)',\
- openwebbeans-web;version='[2.0.13,2.0.14)',\
- org.apache.aries.cdi.extender;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.jaxrs;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-config;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-jwt-auth-tests;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-jwt-auth;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.servlet.common;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.servlet.owb;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extra;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.owb.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.owb.core;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.jax.rs.whiteboard;version='[1.0.7,1.0.8)',\
- org.apache.aries.spifly.dynamic.framework.extension;version='[1.2.3,1.2.4)',\
- org.apache.commons.io;version='[2.6.0,2.6.1)',\
- org.apache.commons.logging;version='[1.2.0,1.2.1)',\
- org.apache.felix.configadmin;version='[1.9.10,1.9.11)',\
- org.apache.felix.converter;version='[1.0.12,1.0.13)',\
- org.apache.felix.gogo.command;version='[1.1.0,1.1.1)',\
- org.apache.felix.gogo.runtime;version='[1.1.2,1.1.3)',\
- org.apache.felix.gogo.shell;version='[1.1.2,1.1.3)',\
- org.apache.felix.http.jetty;version='[4.0.14,4.0.15)',\
- org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
- org.apache.geronimo.specs.geronimo-annotation_1.3_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-atinject_1.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-el_2.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-interceptor_1.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jaxrs_2.1_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jcdi_2.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-json_1.1_spec;version='[1.3.0,1.3.1)',\
- org.apache.geronimo.specs.geronimo-jsonb_1.0_spec;version='[1.2.0,1.2.1)',\
- org.apache.httpcomponents.httpclient;version='[4.5.3,4.5.4)',\
- org.apache.httpcomponents.httpcore;version='[4.4.6,4.4.7)',\
- org.apache.johnzon.core;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.jsonb;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.mapper;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.osgi;version='[1.2.3,1.2.4)',\
- org.apache.servicemix.bundles.junit;version='[4.12.0,4.12.1)',\
- org.apache.xbean.asm7-shaded;version='[4.13.0,4.13.1)',\
- org.apache.xbean.bundleutils;version='[4.15.0,4.15.1)',\
- org.apache.xbean.finder-shaded;version='[4.13.0,4.13.1)',\
- org.assertj.core;version='[3.13.2,3.13.3)',\
- org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
- org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\
- org.osgi.test.common;version='[1.0.0,1.0.1)',\
- org.osgi.test.junit4;version='[1.0.0,1.0.1)',\
- org.osgi.util.function;version='[1.1.0,1.1.1)',\
- org.osgi.util.promise;version='[1.1.0,1.1.1)'
diff --git a/cdi-extension-mp-jwt-auth/pom.xml b/cdi-extension-mp-jwt-auth/pom.xml
index a40f057..6e3e688 100644
--- a/cdi-extension-mp-jwt-auth/pom.xml
+++ b/cdi-extension-mp-jwt-auth/pom.xml
@@ -393,50 +393,6 @@
</execution>
</executions>
</plugin>
- <!-- This dynamically calculates all the things we need to run our code. -->
- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-resolver-maven-plugin</artifactId>
- <configuration>
- <bundles>
- <bundle>target/${project.build.finalName}-tests.jar</bundle>
- </bundles>
- <failOnChanges>false</failOnChanges>
- <includeDependencyManagement>true</includeDependencyManagement>
- <reportOptional>false</reportOptional>
- <scopes>
- <scope>compile</scope>
- <scope>runtime</scope>
- <scope>test</scope>
- </scopes>
- </configuration>
- <executions>
- <execution>
- <id>resolve-test-owb</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <bndruns>
- <bndrun>owb-itest.bndrun</bndrun>
- </bndruns>
- </configuration>
- </execution>
- <execution>
- <id>resolve-test-weld</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <bndruns>
- <bndrun>weld-itest.bndrun</bndrun>
- </bndruns>
- </configuration>
- </execution>
- </executions>
- </plugin>
<!-- This is the plugin runs the OSGi integration tests. -->
<plugin>
<groupId>biz.aQute.bnd</groupId>
@@ -447,7 +403,7 @@
</bundles>
<failOnChanges>false</failOnChanges>
<includeDependencyManagement>true</includeDependencyManagement>
- <resolve>false</resolve>
+ <resolve>true</resolve>
<scopes>
<scope>compile</scope>
<scope>runtime</scope>
@@ -479,41 +435,6 @@
</execution>
</executions>
</plugin>
- <!-- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-run-maven-plugin</artifactId>
- <configuration>
- <bundles>
- <bundle>target/${project.build.finalName}-tests.jar</bundle>
- </bundles>
- <includeDependencyManagement>true</includeDependencyManagement>
- <scopes>
- <scope>compile</scope>
- <scope>runtime</scope>
- <scope>test</scope>
- </scopes>
- </configuration>
- <executions>
- <execution>
- <id>run-owb</id>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <bndrun>owb-itest.bndrun</bndrun>
- </configuration>
- </execution>
- <execution>
- <id>run-weld</id>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <bndrun>weld-itest.bndrun</bndrun>
- </configuration>
- </execution>
- </executions>
- </plugin> -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
diff --git a/cdi-extension-mp-jwt-auth/src/main/java/org/apache/aries/cdi/extension/mp/jwt/JwtAuthFilter.java b/cdi-extension-mp-jwt-auth/src/main/java/org/apache/aries/cdi/extension/mp/jwt/JwtAuthFilter.java
new file mode 100644
index 0000000..a9100dd
--- /dev/null
+++ b/cdi-extension-mp-jwt-auth/src/main/java/org/apache/aries/cdi/extension/mp/jwt/JwtAuthFilter.java
@@ -0,0 +1,86 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.aries.cdi.extension.mp.jwt;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+
+public class JwtAuthFilter implements ContainerRequestFilter, Filter {
+
+ private final Filter delegate;
+ private final ClassLoader loader;
+
+ public JwtAuthFilter(Filter delegate, ClassLoader loader) {
+ this.delegate = delegate;
+ this.loader = loader;
+ }
+
+ @Override
+ public void init(FilterConfig arg0) throws ServletException {
+ Thread currentThread = Thread.currentThread();
+ ClassLoader current = currentThread.getContextClassLoader();
+
+ try {
+ currentThread.setContextClassLoader(loader);
+ delegate.init(arg0);
+ }
+ finally {
+ currentThread.setContextClassLoader(current);
+ }
+ }
+
+ @Override
+ public void filter(ContainerRequestContext requestContext) throws IOException {
+ }
+
+ @Override
+ public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
+ throws IOException, ServletException {
+
+ Thread currentThread = Thread.currentThread();
+ ClassLoader current = currentThread.getContextClassLoader();
+
+ try {
+ currentThread.setContextClassLoader(loader);
+ delegate.doFilter(arg0, arg1, arg2);
+ }
+ finally {
+ currentThread.setContextClassLoader(current);
+ }
+ }
+
+ @Override
+ public void destroy() {
+ Thread currentThread = Thread.currentThread();
+ ClassLoader current = currentThread.getContextClassLoader();
+
+ try {
+ currentThread.setContextClassLoader(loader);
+ delegate.destroy();
+ }
+ finally {
+ currentThread.setContextClassLoader(current);
+ }
+ }
+
+}
diff --git a/cdi-extension-mp-jwt-auth/src/main/java/org/apache/aries/cdi/extension/mp/jwt/MPJwtAuthExtension.java b/cdi-extension-mp-jwt-auth/src/main/java/org/apache/aries/cdi/extension/mp/jwt/MPJwtAuthExtension.java
index 0ad32a1..0c69178 100644
--- a/cdi-extension-mp-jwt-auth/src/main/java/org/apache/aries/cdi/extension/mp/jwt/MPJwtAuthExtension.java
+++ b/cdi-extension-mp-jwt-auth/src/main/java/org/apache/aries/cdi/extension/mp/jwt/MPJwtAuthExtension.java
@@ -56,11 +56,7 @@
import javax.enterprise.inject.spi.WithAnnotations;
import javax.enterprise.inject.spi.configurator.AnnotatedTypeConfigurator;
import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.DynamicFeature;
@@ -103,6 +99,7 @@
@SuppressWarnings("serial")
private final static Set<String> defaultSelects = new HashSet<String>() {{
+ add(format("(%s=%s)", JAX_RS_NAME, "jwt.auth.filter"));
add(format("(%s=%s)", JAX_RS_NAME, "jwt.roles.allowed"));
add(format("(%s=%s)", JAX_RS_NAME, "jwt.request.forwarder"));
add(format("(%s=%s)", JAX_RS_NAME, "jwt.exception.mapper"));
@@ -201,60 +198,16 @@
properties.put(HTTP_WHITEBOARD_FILTER_PATTERN, config.read("filter.mapping.default", "/*"));
properties.put(HTTP_WHITEBOARD_FILTER_ASYNC_SUPPORTED, true);
properties.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE - 1000);
+ properties.put(JAX_RS_APPLICATION_SELECT, applicationSelectFilter("(!(jwt.auth.filter=false))"));
+ properties.put(JAX_RS_EXTENSION, Boolean.TRUE);
+ properties.put(JAX_RS_NAME, "jwt.auth.filter");
final GeronimoJwtAuthFilter jwtAuthFilter = get(GeronimoJwtAuthFilter.class, beanManager);
_jwtAuthFilterRegistration = bundleContext.registerService(
- Filter.class,
- new Filter() {
- final Filter delegate = jwtAuthFilter;
- final ClassLoader loader = bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader();
-
- @Override
- public void init(FilterConfig arg0) throws ServletException {
- Thread currentThread = Thread.currentThread();
- ClassLoader current = currentThread.getContextClassLoader();
-
- try {
- currentThread.setContextClassLoader(loader);
- delegate.init(arg0);
- }
- finally {
- currentThread.setContextClassLoader(current);
- }
- }
-
- @Override
- public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
- throws IOException, ServletException {
-
- Thread currentThread = Thread.currentThread();
- ClassLoader current = currentThread.getContextClassLoader();
-
- try {
- currentThread.setContextClassLoader(loader);
- delegate.doFilter(arg0, arg1, arg2);
- }
- finally {
- currentThread.setContextClassLoader(current);
- }
- }
-
- @Override
- public void destroy() {
- Thread currentThread = Thread.currentThread();
- ClassLoader current = currentThread.getContextClassLoader();
-
- try {
- currentThread.setContextClassLoader(loader);
- delegate.destroy();
- }
- finally {
- currentThread.setContextClassLoader(current);
- }
- }
-
- }, properties);
+ new String[] {ContainerRequestFilter.class.getName(), Filter.class.getName()},
+ new JwtAuthFilter(jwtAuthFilter, bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader()),
+ properties);
}
void registerJaxrsRolesAllowed(BeanManager beanManager) {
diff --git a/cdi-extension-mp-jwt-auth/weld-itest.bndrun b/cdi-extension-mp-jwt-auth/weld-itest.bndrun
index 3bd9712..a7025c4 100644
--- a/cdi-extension-mp-jwt-auth/weld-itest.bndrun
+++ b/cdi-extension-mp-jwt-auth/weld-itest.bndrun
@@ -19,53 +19,3 @@
-runblacklist: \
osgi.identity;filter:='(osgi.identity=*owb*)'
-
--runbundles: \
- jboss-classfilewriter;version='[1.2.4,1.2.5)',\
- org.apache.aries.cdi.extender;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.jaxrs;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-config;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-jwt-auth-tests;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-jwt-auth;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.servlet.common;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.servlet.weld;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extra;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.weld;version='[1.1.0,1.1.1)',\
- org.apache.aries.jax.rs.whiteboard;version='[1.0.7,1.0.8)',\
- org.apache.aries.spifly.dynamic.framework.extension;version='[1.2.3,1.2.4)',\
- org.apache.commons.io;version='[2.6.0,2.6.1)',\
- org.apache.commons.logging;version='[1.2.0,1.2.1)',\
- org.apache.felix.configadmin;version='[1.9.10,1.9.11)',\
- org.apache.felix.converter;version='[1.0.12,1.0.13)',\
- org.apache.felix.gogo.command;version='[1.1.0,1.1.1)',\
- org.apache.felix.gogo.runtime;version='[1.1.2,1.1.3)',\
- org.apache.felix.gogo.shell;version='[1.1.2,1.1.3)',\
- org.apache.felix.http.jetty;version='[4.0.14,4.0.15)',\
- org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
- org.apache.geronimo.specs.geronimo-annotation_1.3_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-atinject_1.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-el_2.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-interceptor_1.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jaxrs_2.1_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jcdi_2.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-json_1.1_spec;version='[1.3.0,1.3.1)',\
- org.apache.geronimo.specs.geronimo-jsonb_1.0_spec;version='[1.2.0,1.2.1)',\
- org.apache.httpcomponents.httpclient;version='[4.5.3,4.5.4)',\
- org.apache.httpcomponents.httpcore;version='[4.4.6,4.4.7)',\
- org.apache.johnzon.core;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.jsonb;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.mapper;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.osgi;version='[1.2.3,1.2.4)',\
- org.apache.servicemix.bundles.junit;version='[4.12.0,4.12.1)',\
- org.assertj.core;version='[3.13.2,3.13.3)',\
- org.jboss.logging.jboss-logging;version='[3.3.2,3.3.3)',\
- org.jboss.spec.javax.ejb.jboss-ejb-api_3.2_spec;version='[2.0.0,2.0.1)',\
- org.jboss.weld.osgi-bundle;version='[3.1.3,3.1.4)',\
- org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
- org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\
- org.osgi.test.common;version='[1.0.0,1.0.1)',\
- org.osgi.test.junit4;version='[1.0.0,1.0.1)',\
- org.osgi.util.function;version='[1.1.0,1.1.1)',\
- org.osgi.util.promise;version='[1.1.0,1.1.1)'
diff --git a/cdi-extension-mp-metrics/owb-itest.bndrun b/cdi-extension-mp-metrics/owb-itest.bndrun
index a16b8a7..0d26e61 100644
--- a/cdi-extension-mp-metrics/owb-itest.bndrun
+++ b/cdi-extension-mp-metrics/owb-itest.bndrun
@@ -18,50 +18,3 @@
-runblacklist: \
osgi.identity;filter:='(osgi.identity=*weld*)'
-
--runbundles: \
- openwebbeans-impl;version='[2.0.13,2.0.14)',\
- openwebbeans-spi;version='[2.0.13,2.0.14)',\
- org.apache.aries.cdi.extender;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-metrics-tests;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-metrics;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extra;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.owb.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.owb.core;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.jax.rs.whiteboard;version='[1.0.7,1.0.8)',\
- org.apache.aries.spifly.dynamic.framework.extension;version='[1.2.3,1.2.4)',\
- org.apache.commons.logging;version='[1.2.0,1.2.1)',\
- org.apache.felix.configadmin;version='[1.9.10,1.9.11)',\
- org.apache.felix.converter;version='[1.0.12,1.0.13)',\
- org.apache.felix.gogo.command;version='[1.1.0,1.1.1)',\
- org.apache.felix.gogo.runtime;version='[1.1.2,1.1.3)',\
- org.apache.felix.gogo.shell;version='[1.1.2,1.1.3)',\
- org.apache.felix.http.jetty;version='[4.0.14,4.0.15)',\
- org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
- org.apache.geronimo.specs.geronimo-annotation_1.3_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-atinject_1.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-el_2.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-interceptor_1.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jaxrs_2.1_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jcdi_2.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-json_1.1_spec;version='[1.3.0,1.3.1)',\
- org.apache.geronimo.specs.geronimo-jsonb_1.0_spec;version='[1.2.0,1.2.1)',\
- org.apache.httpcomponents.httpclient;version='[4.5.3,4.5.4)',\
- org.apache.httpcomponents.httpcore;version='[4.4.6,4.4.7)',\
- org.apache.johnzon.core;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.jsonb;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.mapper;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.osgi;version='[1.2.3,1.2.4)',\
- org.apache.servicemix.bundles.junit;version='[4.12.0,4.12.1)',\
- org.apache.xbean.asm7-shaded;version='[4.13.0,4.13.1)',\
- org.apache.xbean.bundleutils;version='[4.15.0,4.15.1)',\
- org.apache.xbean.finder-shaded;version='[4.13.0,4.13.1)',\
- org.assertj.core;version='[3.13.2,3.13.3)',\
- org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
- org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\
- org.osgi.test.common;version='[1.0.0,1.0.1)',\
- org.osgi.test.junit4;version='[1.0.0,1.0.1)',\
- org.osgi.util.function;version='[1.1.0,1.1.1)',\
- org.osgi.util.promise;version='[1.1.0,1.1.1)'
diff --git a/cdi-extension-mp-metrics/pom.xml b/cdi-extension-mp-metrics/pom.xml
index d57b04d..1ce1f82 100644
--- a/cdi-extension-mp-metrics/pom.xml
+++ b/cdi-extension-mp-metrics/pom.xml
@@ -287,50 +287,6 @@
</execution>
</executions>
</plugin>
- <!-- This dynamically calculates all the things we need to run our code. -->
- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-resolver-maven-plugin</artifactId>
- <configuration>
- <bundles>
- <bundle>target/${project.build.finalName}-tests.jar</bundle>
- </bundles>
- <failOnChanges>false</failOnChanges>
- <includeDependencyManagement>true</includeDependencyManagement>
- <reportOptional>false</reportOptional>
- <scopes>
- <scope>compile</scope>
- <scope>runtime</scope>
- <scope>test</scope>
- </scopes>
- </configuration>
- <executions>
- <execution>
- <id>resolve-test-owb</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <bndruns>
- <bndrun>owb-itest.bndrun</bndrun>
- </bndruns>
- </configuration>
- </execution>
- <execution>
- <id>resolve-test-weld</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <bndruns>
- <bndrun>weld-itest.bndrun</bndrun>
- </bndruns>
- </configuration>
- </execution>
- </executions>
- </plugin>
<!-- This is the plugin runs the OSGi integration tests. -->
<plugin>
<groupId>biz.aQute.bnd</groupId>
@@ -341,7 +297,7 @@
</bundles>
<failOnChanges>false</failOnChanges>
<includeDependencyManagement>true</includeDependencyManagement>
- <resolve>false</resolve>
+ <resolve>true</resolve>
<scopes>
<scope>compile</scope>
<scope>runtime</scope>
@@ -373,41 +329,6 @@
</execution>
</executions>
</plugin>
- <!-- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-run-maven-plugin</artifactId>
- <configuration>
- <bundles>
- <bundle>target/${project.build.finalName}-tests.jar</bundle>
- </bundles>
- <includeDependencyManagement>true</includeDependencyManagement>
- <scopes>
- <scope>compile</scope>
- <scope>runtime</scope>
- <scope>test</scope>
- </scopes>
- </configuration>
- <executions>
- <execution>
- <id>run-owb</id>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <bndrun>owb-itest.bndrun</bndrun>
- </configuration>
- </execution>
- <execution>
- <id>run-weld</id>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <bndrun>weld-itest.bndrun</bndrun>
- </configuration>
- </execution>
- </executions>
- </plugin> -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
diff --git a/cdi-extension-mp-metrics/weld-itest.bndrun b/cdi-extension-mp-metrics/weld-itest.bndrun
index ff1f006..a7025c4 100644
--- a/cdi-extension-mp-metrics/weld-itest.bndrun
+++ b/cdi-extension-mp-metrics/weld-itest.bndrun
@@ -19,48 +19,3 @@
-runblacklist: \
osgi.identity;filter:='(osgi.identity=*owb*)'
-
--runbundles: \
- jboss-classfilewriter;version='[1.2.4,1.2.5)',\
- org.apache.aries.cdi.extender;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-metrics-tests;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.mp-metrics;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extension.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.extra;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.spi;version='[1.1.0,1.1.1)',\
- org.apache.aries.cdi.weld;version='[1.1.0,1.1.1)',\
- org.apache.aries.jax.rs.whiteboard;version='[1.0.7,1.0.8)',\
- org.apache.aries.spifly.dynamic.framework.extension;version='[1.2.3,1.2.4)',\
- org.apache.commons.logging;version='[1.2.0,1.2.1)',\
- org.apache.felix.configadmin;version='[1.9.10,1.9.11)',\
- org.apache.felix.converter;version='[1.0.12,1.0.13)',\
- org.apache.felix.gogo.command;version='[1.1.0,1.1.1)',\
- org.apache.felix.gogo.runtime;version='[1.1.2,1.1.3)',\
- org.apache.felix.gogo.shell;version='[1.1.2,1.1.3)',\
- org.apache.felix.http.jetty;version='[4.0.14,4.0.15)',\
- org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
- org.apache.geronimo.specs.geronimo-annotation_1.3_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-atinject_1.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-el_2.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-interceptor_1.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jaxrs_2.1_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jcdi_2.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-json_1.1_spec;version='[1.3.0,1.3.1)',\
- org.apache.geronimo.specs.geronimo-jsonb_1.0_spec;version='[1.2.0,1.2.1)',\
- org.apache.httpcomponents.httpclient;version='[4.5.3,4.5.4)',\
- org.apache.httpcomponents.httpcore;version='[4.4.6,4.4.7)',\
- org.apache.johnzon.core;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.jsonb;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.mapper;version='[1.2.3,1.2.4)',\
- org.apache.johnzon.osgi;version='[1.2.3,1.2.4)',\
- org.apache.servicemix.bundles.junit;version='[4.12.0,4.12.1)',\
- org.assertj.core;version='[3.13.2,3.13.3)',\
- org.jboss.logging.jboss-logging;version='[3.3.2,3.3.3)',\
- org.jboss.spec.javax.ejb.jboss-ejb-api_3.2_spec;version='[2.0.0,2.0.1)',\
- org.jboss.weld.osgi-bundle;version='[3.1.3,3.1.4)',\
- org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
- org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\
- org.osgi.test.common;version='[1.0.0,1.0.1)',\
- org.osgi.test.junit4;version='[1.0.0,1.0.1)',\
- org.osgi.util.function;version='[1.1.0,1.1.1)',\
- org.osgi.util.promise;version='[1.1.0,1.1.1)',\
diff --git a/cdi-extension-servlet-common/src/main/java/org/apache/aries/cdi/extension/servlet/common/BaseServletExtension.java b/cdi-extension-servlet-common/src/main/java/org/apache/aries/cdi/extension/servlet/common/BaseServletExtension.java
index d025e6a..52ce748 100644
--- a/cdi-extension-servlet-common/src/main/java/org/apache/aries/cdi/extension/servlet/common/BaseServletExtension.java
+++ b/cdi-extension-servlet-common/src/main/java/org/apache/aries/cdi/extension/servlet/common/BaseServletExtension.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -73,9 +73,12 @@
this.configuration = configuration;
}
- void webFilter(@Observes @FiltersOn(annotations = WebFilter.class) ProcessPotentialService pat,
- BeanManager beanManager) {
+ 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();
@@ -83,7 +86,7 @@
if (!annotatedType.isAnnotationPresent(HttpWhiteboardContextSelect.class)) {
ofNullable((String) configuration.get(HTTP_WHITEBOARD_CONTEXT_SELECT)).ifPresent(
- select -> configurator.add(HttpWhiteboardContextSelect.Literal.of(select))
+ select -> configurator.add(HttpWhiteboardContextSelect.Literal.of(select))
);
}
@@ -116,20 +119,22 @@
}
}
- void webListener(@Observes @FiltersOn(annotations = WebListener.class) ProcessPotentialService pat,
- BeanManager beanManager) {
+ void webListener(
+ @Observes @FiltersOn(annotations = WebListener.class) ProcessPotentialService pat,
+ BeanManager beanManager) {
+
final AnnotatedType<?> annotatedType = pat.getAnnotatedType();
final Class<?> javaClass = annotatedType.getJavaClass();
final Class<?>[] serviceTypes = Stream.of(
- ServletContextListener.class,
- ServletContextAttributeListener.class,
- ServletRequestListener.class,
- ServletRequestAttributeListener.class,
- HttpSessionListener.class,
- HttpSessionAttributeListener.class,
- HttpSessionIdListener.class)
- .filter(c -> c.isAssignableFrom(javaClass))
- .toArray(Class[]::new);
+ ServletContextListener.class,
+ ServletContextAttributeListener.class,
+ ServletRequestListener.class,
+ ServletRequestAttributeListener.class,
+ HttpSessionListener.class,
+ HttpSessionAttributeListener.class,
+ HttpSessionIdListener.class)
+ .filter(c -> c.isAssignableFrom(javaClass))
+ .toArray(Class[]::new);
beanManager.fireEvent(MergeServiceTypes.forEvent(pat).withTypes(serviceTypes).build());
@@ -139,7 +144,7 @@
if (!annotatedType.isAnnotationPresent(HttpWhiteboardContextSelect.class)) {
ofNullable((String) configuration.get(HTTP_WHITEBOARD_CONTEXT_SELECT)).ifPresent(
- select -> configurator.add(HttpWhiteboardContextSelect.Literal.of(select))
+ select -> configurator.add(HttpWhiteboardContextSelect.Literal.of(select))
);
}
@@ -152,8 +157,10 @@
}
}
- void webServlet(@Observes @FiltersOn(annotations = WebServlet.class) ProcessPotentialService pat,
- BeanManager beanManager) {
+ void webServlet(
+ @Observes @FiltersOn(annotations = WebServlet.class) ProcessPotentialService pat,
+ BeanManager beanManager) {
+
beanManager.fireEvent(MergeServiceTypes.forEvent(pat).withTypes(Servlet.class).build());
final AnnotatedTypeConfigurator<?> configurator = pat.configureAnnotatedType();
@@ -162,7 +169,7 @@
if (!annotatedType.isAnnotationPresent(HttpWhiteboardContextSelect.class)) {
ofNullable((String) configuration.get(HTTP_WHITEBOARD_CONTEXT_SELECT)).ifPresent(
- select -> configurator.add(HttpWhiteboardContextSelect.Literal.of(select))
+ select -> configurator.add(HttpWhiteboardContextSelect.Literal.of(select))
);
}
@@ -213,3 +220,4 @@
}
}
}
+
diff --git a/cdi-extension-servlet-owb/src/main/java/org/apache/aries/cdi/extension/servlet/owb/OWBServletExtension.java b/cdi-extension-servlet-owb/src/main/java/org/apache/aries/cdi/extension/servlet/owb/OWBServletExtension.java
index 1ed2c4f..0bc74b1 100644
--- a/cdi-extension-servlet-owb/src/main/java/org/apache/aries/cdi/extension/servlet/owb/OWBServletExtension.java
+++ b/cdi-extension-servlet-owb/src/main/java/org/apache/aries/cdi/extension/servlet/owb/OWBServletExtension.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -76,7 +76,8 @@
(proxy, method, args) -> {
try {
return method.invoke(ofNullable(delegateContext).orElseGet(startEvent::getServletContext), args);
- } catch (final InvocationTargetException ite) {
+ }
+ catch (final InvocationTargetException ite) {
throw ite.getTargetException();
}
}));
@@ -87,8 +88,8 @@
}
void afterDeploymentValidation(
- @Observes @Priority(LIBRARY_AFTER + 800)
- AfterDeploymentValidation adv, BeanManager beanManager) {
+ @Observes @Priority(LIBRARY_AFTER + 800)
+ AfterDeploymentValidation adv, BeanManager beanManager) {
Dictionary<String, Object> properties = new Hashtable<>();
properties.put(SERVICE_DESCRIPTION, "Aries CDI - HTTP Portable Extension for OpenWebBeans");
@@ -98,13 +99,13 @@
properties.put(SERVICE_RANKING, Integer.MAX_VALUE - 100);
_listenerRegistration = bundleContext.registerService(
- LISTENER_CLASSES, new CdiListener(WebBeansContext.currentInstance()), properties);
+ LISTENER_CLASSES, new CdiListener(WebBeansContext.currentInstance()), properties);
}
private static final String[] LISTENER_CLASSES = new String[]{
- ServletContextListener.class.getName(),
- ServletRequestListener.class.getName(),
- HttpSessionListener.class.getName()
+ ServletContextListener.class.getName(),
+ ServletRequestListener.class.getName(),
+ HttpSessionListener.class.getName()
};
@Override
@@ -128,7 +129,7 @@
// propagate attributes from the temporary sc
list(startEvent.getServletContext().getAttributeNames()).forEach(
- attr -> realSC.setAttribute(attr, startEvent.getServletContext().getAttribute(attr)));
+ attr -> realSC.setAttribute(attr, startEvent.getServletContext().getAttribute(attr)));
realSC.setAttribute(BundleContext.class.getName(), bundleContext);
realSC.setAttribute(WebBeansContext.class.getName(), webBeansContext);
@@ -144,9 +145,11 @@
public void contextDestroyed(ServletContextEvent sce) {
try {
super.contextDestroyed(sce);
- } finally {
+ }
+ finally {
destroyed.set(true);
}
}
}
}
+
diff --git a/cdi-extension-servlet-weld/src/main/java/org/apache/aries/cdi/extension/servlet/weld/WeldServletExtension.java b/cdi-extension-servlet-weld/src/main/java/org/apache/aries/cdi/extension/servlet/weld/WeldServletExtension.java
index e76e6fe..f4002b0 100644
--- a/cdi-extension-servlet-weld/src/main/java/org/apache/aries/cdi/extension/servlet/weld/WeldServletExtension.java
+++ b/cdi-extension-servlet-weld/src/main/java/org/apache/aries/cdi/extension/servlet/weld/WeldServletExtension.java
@@ -28,7 +28,6 @@
import javax.annotation.Priority;
import javax.enterprise.event.Observes;
-import javax.enterprise.event.ObservesAsync;
import javax.enterprise.inject.spi.AfterDeploymentValidation;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
@@ -62,12 +61,6 @@
@Observes @Priority(LIBRARY_AFTER + 800)
AfterDeploymentValidation adv, BeanManager beanManager) {
- beanManager.getEvent().fireAsync(new Ready());
- }
-
- void ready(
- @ObservesAsync Ready ready, BeanManager beanManager) {
-
Dictionary<String, Object> properties = new Hashtable<>();
properties.put(SERVICE_DESCRIPTION, "Aries CDI - HTTP Portable Extension for Weld");
@@ -92,8 +85,6 @@
HttpSessionListener.class.getName()
};
- public static class Ready {}
-
private class ListenerWrapper<T extends HttpSessionListener & ServletContextListener & ServletRequestListener>
implements HttpSessionListener, ServletContextListener, ServletRequestListener {
diff --git a/cdi-extension-spi/src/main/java/org/apache/aries/cdi/extension/spi/adapt/FiltersOn.java b/cdi-extension-spi/src/main/java/org/apache/aries/cdi/extension/spi/adapt/FiltersOn.java
index af826ae..0266255 100644
--- a/cdi-extension-spi/src/main/java/org/apache/aries/cdi/extension/spi/adapt/FiltersOn.java
+++ b/cdi-extension-spi/src/main/java/org/apache/aries/cdi/extension/spi/adapt/FiltersOn.java
@@ -28,10 +28,6 @@
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface FiltersOn {
- /**
- * @return the annotations the {@link javax.enterprise.inject.spi.ProcessAnnotatedType} should get filtered for.
- */
- Class<? extends Annotation>[] annotations() default {FiltersOn.class};
/**
* @return the types to filter the event on using {@link Class#isAssignableFrom(Class)}.
@@ -53,5 +49,11 @@
return defaultArray;
}
}
+
+ /**
+ * @return the annotations the {@link javax.enterprise.inject.spi.ProcessAnnotatedType} should get filtered for.
+ */
+ Class<? extends Annotation>[] annotations() default {FiltersOn.class};
+
}
diff --git a/cdi-owb/pom.xml b/cdi-owb/pom.xml
index 14b1fcd..f8acc0d 100644
--- a/cdi-owb/pom.xml
+++ b/cdi-owb/pom.xml
@@ -91,6 +91,11 @@
<version>${owb.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <version>${owb.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-bundleutils</artifactId>
<version>4.15</version>
diff --git a/pom.xml b/pom.xml
index 7d9dbea..9498525 100644
--- a/pom.xml
+++ b/pom.xml
@@ -266,7 +266,7 @@
<id>experimental</id>
<properties>
<experimental>true</experimental>
- <bnd.version>5.1.0-SNAPSHOT</bnd.version>
+ <bnd.version>5.0.0-SNAPSHOT</bnd.version>
<johnzon.version>1.2.3-SNAPSHOT</johnzon.version>
</properties>
<modules>