[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224007#comment-16224007
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on a change in pull request #329: CXF-7501: Cannot inject field 
in ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147582392
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   Thanks for spotting that @johnament, I will address it shortly.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is 

[jira] [Created] (CXF-7543) JAX-RS Features not used in proxies or WebClients

2017-10-29 Thread John D. Ament (JIRA)
John D. Ament created CXF-7543:
--

 Summary: JAX-RS Features not used in proxies or WebClients
 Key: CXF-7543
 URL: https://issues.apache.org/jira/browse/CXF-7543
 Project: CXF
  Issue Type: Bug
Affects Versions: 3.2.0
Reporter: John D. Ament


Suppose that you are using JAXRSClientFactoryBean to create a new client.  You 
may call some code like this:
{code}
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(baseUri);
bean.setServiceClass(aClass);
bean.setProviders(asList(new SomeFeature()));
bean.setProperties(properties);
return bean.create(aClass);
{code}

If your {{SomeFeature}} registers additional providers, then those providers 
are never considered for use on the proxy or WebClient instance created.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224044#comment-16224044
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on a change in pull request #329: CXF-7501: Cannot inject field 
in ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147584922
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   @johnament hmm (my turn), so in the test case we have there are 2 providers: 
one from bean archive, another from regular JAR file (not a bean archive). In 
both cases, the bean is located successfully. Looking why, BeanManager 
implementation (OWB, Weld) does the fallback in case there is no bean archive 
for a class available.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) th

[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224045#comment-16224045
 ] 

ASF GitHub Bot commented on CXF-7501:
-

rmannibucau commented on a change in pull request #329: CXF-7501: Cannot inject 
field in ContainerRequestFilter (and generally, into any providers registered 
using FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147585124
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   @reta if not a bean you will not get a Bean instance doing the lookup 
(empty Set). If it is found it means the jar was scanned and the bean activated 
somehow. The issue can come from the test setup, did you try with jackson for 
instance or a plain custom-provider-nocdi.jar?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsCont

[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224048#comment-16224048
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on a change in pull request #329: CXF-7501: Cannot inject field 
in ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147585253
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   I did with `AtomFeedProvider` from plain no CDI archive, let me try Jackson 
to be sure :)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our obj

[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224050#comment-16224050
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on a change in pull request #329: CXF-7501: Cannot inject field 
in ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147585376
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   @rmannibucau  No issues, works just fine for Jackson as well (no deployment 
archives are present but the bean was synthesized from the class). 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProd

[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224049#comment-16224049
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on a change in pull request #329: CXF-7501: Cannot inject field 
in ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147585376
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   @johnament No issues, works just fine for Jackson as well (no deployment 
archives are present but the bean was synthesized from the class). 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProduce

[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224056#comment-16224056
 ] 

ASF GitHub Bot commented on CXF-7501:
-

rmannibucau commented on a change in pull request #329: CXF-7501: Cannot inject 
field in ContainerRequestFilter (and generally, into any providers registered 
using FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147585617
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   this is because you don't lookup a cdi bean but create one, this is probably 
not what we want. We should lookup an existing bean or fallback on creating a 
plain instance (take care of context injection support ;)). If we don't we can 
have side effects in applications duplicating beans during lookup or just 
pollute the CDI context for no reason.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerReques

[jira] [Assigned] (CXF-7543) JAX-RS Features not used in proxies or WebClients

2017-10-29 Thread Andriy Redko (JIRA)

 [ 
https://issues.apache.org/jira/browse/CXF-7543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andriy Redko reassigned CXF-7543:
-

Assignee: Andriy Redko

> JAX-RS Features not used in proxies or WebClients
> -
>
> Key: CXF-7543
> URL: https://issues.apache.org/jira/browse/CXF-7543
> Project: CXF
>  Issue Type: Bug
>Affects Versions: 3.2.0
>Reporter: John D. Ament
>Assignee: Andriy Redko
>
> Suppose that you are using JAXRSClientFactoryBean to create a new client.  
> You may call some code like this:
> {code}
> JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
> bean.setAddress(baseUri);
> bean.setServiceClass(aClass);
> bean.setProviders(asList(new SomeFeature()));
> bean.setProperties(properties);
> return bean.create(aClass);
> {code}
> If your {{SomeFeature}} registers additional providers, then those providers 
> are never considered for use on the proxy or WebClient instance created.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224057#comment-16224057
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on a change in pull request #329: CXF-7501: Cannot inject field 
in ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147585824
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   so basically the better way would be to call beanManager.getBeans() to 
ensure there is one in the context, and fallback to createBean if none, right? 
:-)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRs

[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224059#comment-16224059
 ] 

ASF GitHub Bot commented on CXF-7501:
-

johnament commented on issue #329: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/329#issuecomment-340273268
 
 
   Could you double check with an explicitly @Vetoed provider?  I believe the
   way you run the CDI teats it discovers all veans regardless of beans.xml.
   
   On Oct 29, 2017 11:47 AM, "Andriy Redko"  wrote:
   
   > *@reta* commented on this pull request.
   > --
   >
   > In integration/cdi/src/main/java/org/apache/cxf/cdi/
   > CdiServerConfigurableFactory.java
   > :
   >
   > > +public Configurable create(FeatureContext context) {
   > +return new CdiServerFeatureContextConfigurable(context, 
beanManager);
   > +}
   > +
   > +/**
   > + * Instantiates the instance of the provider using CDI/BeanManager
   > + */
   > +private static class CdiInstantiator implements Instantiator {
   > +private final BeanManager beanManager;
   > +
   > +CdiInstantiator(final BeanManager beanManager) {
   > +this.beanManager = beanManager;
   > +}
   > +
   > +@Override
   > +public  Object create(Class cls) {
   >
   > @johnament  No issues, works just fine for
   > Jackson as well (no deployment archives are present but the bean was
   > synthesized from the class).
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > , or mute
   > the thread
   > 

   > .
   >
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224075#comment-16224075
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on issue #329: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/329#issuecomment-340273566
 
 
   @johnament yes, sure, I can add one @Vetoed guy. The tests do not hijack 
anything,  CDI container **does not** discover all the beans, the `bean.xml` 
presence is strictly honored. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224077#comment-16224077
 ] 

ASF GitHub Bot commented on CXF-7501:
-

rmannibucau commented on a change in pull request #329: CXF-7501: Cannot inject 
field in ContainerRequestFilter (and generally, into any providers registered 
using FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147586166
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   nop, try getbeans and if resolve() returns null then use standalone logic 
(default newInstance())


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> f

[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224078#comment-16224078
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on a change in pull request #329: CXF-7501: Cannot inject field 
in ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/329#discussion_r147586312
 
 

 ##
 File path: 
integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 ##
 @@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanAttributes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTargetFactory;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configurable;
+import javax.ws.rs.core.FeatureContext;
+
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
+import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
+
+/** 
+ * Creates the instance of Configurable suitable for CDI-managed runtime.
+ */
+public class CdiServerConfigurableFactory implements ServerConfigurableFactory 
{
+private final BeanManager beanManager;
+
+CdiServerConfigurableFactory(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public Configurable create(FeatureContext context) {
+return new CdiServerFeatureContextConfigurable(context, beanManager);
+}
+
+/** 
+ * Instantiates the instance of the provider using CDI/BeanManager 
+ */
+private static class CdiInstantiator implements Instantiator {
+private final BeanManager beanManager;
+
+CdiInstantiator(final BeanManager beanManager) {
+this.beanManager = beanManager;
+}
+
+@Override
+public  Object create(Class cls) {
 
 Review comment:
   sounds good, thanks @rmannibucau 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the containe

[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224103#comment-16224103
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta opened a new pull request #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330
 
 
   Using proper CDI bean resolution with fallback to default strategy. The 
`@Vetoed` presented an edge case when CDI runtime won't resolve the bean but we 
have to go over manual instantiation. 
   
   CC @rmannibucau @johnament 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224106#comment-16224106
 ] 

ASF GitHub Bot commented on CXF-7501:
-

rmannibucau commented on issue #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330#issuecomment-340279477
 
 
   LGTM
   
   side note: do we have a test covering @Context injection/instantiation too? 
Wonder if we need a third case where we do the injection normally (standalone) 
then create an InjectionTarget to integrate with CDI.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224107#comment-16224107
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on issue #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330#issuecomment-340279707
 
 
   Thanks @rmannibucau, we should be good here as `@Context` members are 
injected independently, but sure, it is good idea to have a test case.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224108#comment-16224108
 ] 

ASF GitHub Bot commented on CXF-7501:
-

rmannibucau commented on issue #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330#issuecomment-340279887
 
 
   @ApplicationScoped the provider, will be proxied so the injection will not 
be done as expected ;). A workaround used can be to support @Inject @Context 
but that's a workaround but CDI doesn't enable us to do more yet until you add 
automatically an @AroundConstruct interceptor to do the injection.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224110#comment-16224110
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on issue #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330#issuecomment-340280285
 
 
   @rmannibucau I see, proxies do mess things up. I think would be good to 
solve that as a separate issue, it has more broad impact that the one this PR 
concerns. I will create a test case to reproduce that and an issue in the 
tracker. Sounds like a plan?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224112#comment-16224112
 ] 

ASF GitHub Bot commented on CXF-7501:
-

rmannibucau commented on issue #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330#issuecomment-340280475
 
 
   +1, that's why it was a side note ;)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (CXF-7544) Support @Context-based injection into proxied CDI beans

2017-10-29 Thread Andriy Redko (JIRA)
Andriy Redko created CXF-7544:
-

 Summary: Support @Context-based injection into proxied CDI beans
 Key: CXF-7544
 URL: https://issues.apache.org/jira/browse/CXF-7544
 Project: CXF
  Issue Type: Bug
Affects Versions: 3.2.0, 3.1.13
Reporter: Andriy Redko
Assignee: Andriy Redko


The issue pop up as part of https://github.com/apache/cxf/pull/330 discussion. 
In case when provider / feature / resource is a proxied CDI bean, the 
contextual class members (annotated with @Context) are not injected.

Test case to reproduce:

{code}
@ApplicationScoped
public class BookStoreRequestFilter implements ContainerRequestFilter {
@Context private ResourceInfo resourceInfo;

@Override
public void filter(ContainerRequestContext requestContext) throws 
IOException {
// Contextual instances should be injected independently
if (resourceInfo == null || resourceInfo.getResourceMethod() == null) {
requestContext.abortWith(Response.serverError().build());
}
}
}
{code}





--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224115#comment-16224115
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on issue #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330#issuecomment-340281055
 
 
   Done, https://issues.apache.org/jira/browse/CXF-7544. @rmannibucau 
@johnament Thank you guys for helping out with proper implementation. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (CXF-7544) Support @Context-based injection into proxied CDI beans

2017-10-29 Thread Andriy Redko (JIRA)

 [ 
https://issues.apache.org/jira/browse/CXF-7544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andriy Redko updated CXF-7544:
--
Description: 
The issue pop up as part of https://github.com/apache/cxf/pull/330 discussion. 
In case when provider / feature / resource is a proxied CDI bean, the 
contextual class members (annotated with @Context) are not injected.

Test case to reproduce:

{code}
@ApplicationScoped
public class BookStoreRequestFilter implements ContainerRequestFilter {
@Context private ResourceInfo resourceInfo;

@Override
public void filter(ContainerRequestContext requestContext) throws 
IOException {
// Contextual instances should be injected independently
if (resourceInfo == null || resourceInfo.getResourceMethod() == null) {
requestContext.abortWith(Response.serverError().build());
}
}
}
{code}

CC [~rmannibucau]

  was:
The issue pop up as part of https://github.com/apache/cxf/pull/330 discussion. 
In case when provider / feature / resource is a proxied CDI bean, the 
contextual class members (annotated with @Context) are not injected.

Test case to reproduce:

{code}
@ApplicationScoped
public class BookStoreRequestFilter implements ContainerRequestFilter {
@Context private ResourceInfo resourceInfo;

@Override
public void filter(ContainerRequestContext requestContext) throws 
IOException {
// Contextual instances should be injected independently
if (resourceInfo == null || resourceInfo.getResourceMethod() == null) {
requestContext.abortWith(Response.serverError().build());
}
}
}
{code}




> Support @Context-based injection into proxied CDI beans
> ---
>
> Key: CXF-7544
> URL: https://issues.apache.org/jira/browse/CXF-7544
> Project: CXF
>  Issue Type: Bug
>Affects Versions: 3.1.13, 3.2.0
>Reporter: Andriy Redko
>Assignee: Andriy Redko
>
> The issue pop up as part of https://github.com/apache/cxf/pull/330 
> discussion. In case when provider / feature / resource is a proxied CDI bean, 
> the contextual class members (annotated with @Context) are not injected.
> Test case to reproduce:
> {code}
> @ApplicationScoped
> public class BookStoreRequestFilter implements ContainerRequestFilter {
> @Context private ResourceInfo resourceInfo;
> 
> @Override
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> // Contextual instances should be injected independently
> if (resourceInfo == null || resourceInfo.getResourceMethod() == null) 
> {
> requestContext.abortWith(Response.serverError().build());
> }
> }
> }
> {code}
> CC [~rmannibucau]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224117#comment-16224117
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta closed pull request #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
 
b/integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
index 15d4643d847..9090bbfa664 100644
--- 
a/integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
+++ 
b/integration/cdi/src/main/java/org/apache/cxf/cdi/CdiServerConfigurableFactory.java
@@ -18,12 +18,11 @@
  */
 package org.apache.cxf.cdi;
 
+import java.util.Set;
+
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanAttributes;
 import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionTargetFactory;
 import javax.ws.rs.RuntimeType;
 import javax.ws.rs.core.Configurable;
 import javax.ws.rs.core.FeatureContext;
@@ -31,6 +30,7 @@
 import org.apache.cxf.cdi.event.DisposableCreationalContext;
 import org.apache.cxf.jaxrs.impl.ConfigurableImpl;
 import org.apache.cxf.jaxrs.impl.ConfigurableImpl.Instantiator;
+import org.apache.cxf.jaxrs.impl.ConfigurationImpl;
 import org.apache.cxf.jaxrs.provider.ServerConfigurableFactory;
 
 /** 
@@ -49,7 +49,8 @@
 }
 
 /** 
- * Instantiates the instance of the provider using CDI/BeanManager 
+ * Instantiates the instance of the provider using CDI/BeanManager (or 
fall back
+ * to default strategy of CDI bean is not available).
  */
 private static class CdiInstantiator implements Instantiator {
 private final BeanManager beanManager;
@@ -60,18 +61,21 @@
 
 @Override
 public  Object create(Class cls) {
-final AnnotatedType annotatedType = 
beanManager.createAnnotatedType(cls);
-final InjectionTargetFactory injectionTargetFactory = 
-beanManager.getInjectionTargetFactory(annotatedType);
-final BeanAttributes attributes = 
beanManager.createBeanAttributes(annotatedType);
-final Bean bean = beanManager.createBean(attributes, cls, 
injectionTargetFactory);
-final CreationalContext context = 
beanManager.createCreationalContext(bean);
-
-if (!beanManager.isNormalScope(bean.getScope())) {
-beanManager.fireEvent(new 
DisposableCreationalContext(context));
+final Set> candidates = beanManager.getBeans(cls);
+final Bean bean = beanManager.resolve(candidates);
+
+if (bean != null) {
+final CreationalContext context = 
beanManager.createCreationalContext(bean);
+
+if (!beanManager.isNormalScope(bean.getScope())) {
+beanManager.fireEvent(new 
DisposableCreationalContext(context));
+}
+
+return beanManager.getReference(bean, cls, context);
+} else {
+// No CDI bean available, falling back to default 
instantiation strategy
+return ConfigurationImpl.createProvider(cls);
 }
-
-return beanManager.getReference(bean, cls, context);
 }
 }
 
diff --git 
a/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/BookStoreRequestFilter.java
 
b/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/BookStoreRequestFilter.java
index cbd88115afe..4fb8f846c4a 100644
--- 
a/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/BookStoreRequestFilter.java
+++ 
b/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/BookStoreRequestFilter.java
@@ -24,14 +24,22 @@
 import javax.inject.Inject;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.ResourceInfo;
+import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 
 public class BookStoreRequestFilter implements ContainerRequestFilter {
 @Inject private BookStoreAuthenticator authenticator;
+@Context private ResourceInfo resourceInfo;
 
 @Override
 public void filter(ContainerRequestContext requestContext) throws 
IOException {
+// Contextual instan

[jira] [Comment Edited] (CXF-7544) Support @Context-based injection into proxied CDI beans

2017-10-29 Thread Romain Manni-Bucau (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224118#comment-16224118
 ] 

Romain Manni-Bucau edited comment on CXF-7544 at 10/29/17 6:09 PM:
---

Think we also have the case of a standard provider with @Context as constructor 
param but @Inject fields (so the bean is not a cdi bean but uses cdi beans)


was (Author: romain.manni-bucau):
Think also have the case of a standard provider with @Context as constructor 
param but @Inject fields (so the bean is not a cdi bean but uses cdi beans)

> Support @Context-based injection into proxied CDI beans
> ---
>
> Key: CXF-7544
> URL: https://issues.apache.org/jira/browse/CXF-7544
> Project: CXF
>  Issue Type: Bug
>Affects Versions: 3.1.13, 3.2.0
>Reporter: Andriy Redko
>Assignee: Andriy Redko
>
> The issue pop up as part of https://github.com/apache/cxf/pull/330 
> discussion. In case when provider / feature / resource is a proxied CDI bean, 
> the contextual class members (annotated with @Context) are not injected.
> Test case to reproduce:
> {code}
> @ApplicationScoped
> public class BookStoreRequestFilter implements ContainerRequestFilter {
> @Context private ResourceInfo resourceInfo;
> 
> @Override
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> // Contextual instances should be injected independently
> if (resourceInfo == null || resourceInfo.getResourceMethod() == null) 
> {
> requestContext.abortWith(Response.serverError().build());
> }
> }
> }
> {code}
> CC [~rmannibucau]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7544) Support @Context-based injection into proxied CDI beans

2017-10-29 Thread Romain Manni-Bucau (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224118#comment-16224118
 ] 

Romain Manni-Bucau commented on CXF-7544:
-

Think also have the case of a standard provider with @Context as constructor 
param but @Inject fields (so the bean is not a cdi bean but uses cdi beans)

> Support @Context-based injection into proxied CDI beans
> ---
>
> Key: CXF-7544
> URL: https://issues.apache.org/jira/browse/CXF-7544
> Project: CXF
>  Issue Type: Bug
>Affects Versions: 3.1.13, 3.2.0
>Reporter: Andriy Redko
>Assignee: Andriy Redko
>
> The issue pop up as part of https://github.com/apache/cxf/pull/330 
> discussion. In case when provider / feature / resource is a proxied CDI bean, 
> the contextual class members (annotated with @Context) are not injected.
> Test case to reproduce:
> {code}
> @ApplicationScoped
> public class BookStoreRequestFilter implements ContainerRequestFilter {
> @Context private ResourceInfo resourceInfo;
> 
> @Override
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> // Contextual instances should be injected independently
> if (resourceInfo == null || resourceInfo.getResourceMethod() == null) 
> {
> requestContext.abortWith(Response.serverError().build());
> }
> }
> }
> {code}
> CC [~rmannibucau]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224121#comment-16224121
 ] 

ASF GitHub Bot commented on CXF-7501:
-

johnament commented on issue #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330#issuecomment-340282232
 
 
   LGTM as well.  FWIW, I was able to cause it to fail using a CDI 2 feature of 
SE initialization.
   
   ```java
   SeContainerInitializer.newInstance()
   .disableDiscovery()
   .addBeanClasses(Resources.class, LoggingReporter.class, 
BraveProducers.class, RestApplication.class, TopCDsEndpoint.class, 
CXFCdiServlet.class)
   .addExtensions(new JAXRSCdiResourceExtension())
   .initialize();
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224127#comment-16224127
 ] 

ASF GitHub Bot commented on CXF-7501:
-

reta commented on issue #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330#issuecomment-340282842
 
 
   To be fair, we haven't tested with CDI 2 yet :-) But if you could summarize 
your observations, including the example above, it would be great help and 
starting point to address that.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7544) Support @Context-based injection into proxied CDI beans

2017-10-29 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224128#comment-16224128
 ] 

John D. Ament commented on CXF-7544:


Does it happen even with the CDIClassUnwrapper in use?

> Support @Context-based injection into proxied CDI beans
> ---
>
> Key: CXF-7544
> URL: https://issues.apache.org/jira/browse/CXF-7544
> Project: CXF
>  Issue Type: Bug
>Affects Versions: 3.1.13, 3.2.0
>Reporter: Andriy Redko
>Assignee: Andriy Redko
>
> The issue pop up as part of https://github.com/apache/cxf/pull/330 
> discussion. In case when provider / feature / resource is a proxied CDI bean, 
> the contextual class members (annotated with @Context) are not injected.
> Test case to reproduce:
> {code}
> @ApplicationScoped
> public class BookStoreRequestFilter implements ContainerRequestFilter {
> @Context private ResourceInfo resourceInfo;
> 
> @Override
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> // Contextual instances should be injected independently
> if (resourceInfo == null || resourceInfo.getResourceMethod() == null) 
> {
> requestContext.abortWith(Response.serverError().build());
> }
> }
> }
> {code}
> CC [~rmannibucau]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7501) Cannot inject field in ContainerRequestFilter

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224132#comment-16224132
 ] 

ASF GitHub Bot commented on CXF-7501:
-

johnament commented on issue #330: CXF-7501: Cannot inject field in 
ContainerRequestFilter (and generally, into any providers registered using 
FeatureContext)
URL: https://github.com/apache/cxf/pull/330#issuecomment-340283415
 
 
   In general, there are no issues using CXF with CDI 2, the integration 
continues to work fine.  This was just something I noticed and wanted to 
confirm as a real issue.
   
   `@Vetoed` was the easiest way I had to explain where it would fail from a 
mobile 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cannot inject field in ContainerRequestFilter
> -
>
> Key: CXF-7501
> URL: https://issues.apache.org/jira/browse/CXF-7501
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 3.1.10, 3.2.0
> Environment: Linux Mint 64 bit, TomEE Plus 7.0.3, JavaEE 7 
> application using MVC specification and reference implementation(Libs 
> Attached)
>Reporter: Jeyvison Nascimento
>Assignee: Andriy Redko
>  Labels: cdi
> Fix For: 3.1.14, 3.2.1
>
> Attachments: javax-mvc.jar, ozark.jar
>
>
> Hey folks.
> We found a weird behavior while running MVC specification(JSR 371) on TomEE 
> witch CXF. We have a *ContainerRequestFilter* defined called 
> *JaxRsContextFilter* 
> {code:java}
> @PreMatching
> @Priority(0)
> public class JaxRsContextFilter implements ContainerRequestFilter {
> @Inject
> private JaxRsContextProducer jaxRsContextProducer;
> @Context
> private Configuration configuration;
> @Context
> private HttpServletRequest request;
> @Context
> private HttpServletResponse response;
> public JaxRsContextFilter() {
> }
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> this.jaxRsContextProducer.populate(this.configuration, this.request, 
> this.response);
> }
> }
> {code}
> You can see that we have a JaxRsContextProducer annotated to be injected as a 
> field in our object but when JAXRSUtils is called to run the the container 
> filters it injects the fields annotated as *@Context* , not the fields 
> annotated with *@Inject*.
> {code:java}
>  for (ProviderInfo filter : containerFilters) {
> try {
> InjectionUtils.injectContexts(filter.getProvider(), 
> filter, m);
> filter.getProvider().filter(context);
> } catch (IOException ex) {
> throw ExceptionUtils.toInternalServerErrorException(ex, 
> null); 
> }
> {code}
> It causes our filter(*JaxRsContextFilter*) to throw a NullPointerException 
> when filtering the request because it uses the producer to perform some 
> actions in  this operation.
> I believe this field should be injected as well, not only the *@Context* 
> fields.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7535) Support for Project Reactor as rx()

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224137#comment-16224137
 ] 

ASF GitHub Bot commented on CXF-7535:
-

johnament opened a new pull request #331: [CXF-7535] Adding client & server 
support for Project Reactor
URL: https://github.com/apache/cxf/pull/331
 
 
   This is still a WIP, so not ready to be merged.
   
   I'm looking to add support for Project Reactor as an rx invoker for CXF.  It 
effectively mirrors what the other two are doing, but using reactor's APIs.
   
   I'm still working on tests (e.g. I don't know if this works).  the biggest 
I'm having right now is getting the `systests` to import in intellij.  I've 
done it previously, but for some reason after switching to 3.2 it's no good.  
I've even gone in, blown away all `.iml` and the `.idea` folder, no luck.  
Anyone else seen something like this?
   
   https://user-images.githubusercontent.com/108167/32147008-28b82138-bcb6-11e7-8744-0fe5e32a2a8f.png";>
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Support for Project Reactor as rx()
> ---
>
> Key: CXF-7535
> URL: https://issues.apache.org/jira/browse/CXF-7535
> Project: CXF
>  Issue Type: New Feature
>  Components: JAX-RS
>Affects Versions: 3.2.0
>Reporter: John D. Ament
>
> It would be good if Project Reactor was supported as an rx() type in CXF.  
> https://github.com/apache/cxf/tree/master/rt/rs/extensions/rx - only shows rx 
> java and rx java 2.  project reactor/reactor core seem like the v3's of this 
> api stack.
> https://projectreactor.io/



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7535) Support for Project Reactor as rx()

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224143#comment-16224143
 ] 

ASF GitHub Bot commented on CXF-7535:
-

deki commented on issue #331: [CXF-7535] Adding client & server support for 
Project Reactor
URL: https://github.com/apache/cxf/pull/331#issuecomment-340284830
 
 
   Usually I have this issue if I miss some Maven profile selections. Adjusting 
the checkboxes normally fixes this.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Support for Project Reactor as rx()
> ---
>
> Key: CXF-7535
> URL: https://issues.apache.org/jira/browse/CXF-7535
> Project: CXF
>  Issue Type: New Feature
>  Components: JAX-RS
>Affects Versions: 3.2.0
>Reporter: John D. Ament
>
> It would be good if Project Reactor was supported as an rx() type in CXF.  
> https://github.com/apache/cxf/tree/master/rt/rs/extensions/rx - only shows rx 
> java and rx java 2.  project reactor/reactor core seem like the v3's of this 
> api stack.
> https://projectreactor.io/



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7544) Support @Context-based injection into proxied CDI beans

2017-10-29 Thread Romain Manni-Bucau (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224157#comment-16224157
 ] 

Romain Manni-Bucau commented on CXF-7544:
-

Yes cause issue is ot only the model but also the instance used. Can need an 
AroundConstruct to be solved properly.

> Support @Context-based injection into proxied CDI beans
> ---
>
> Key: CXF-7544
> URL: https://issues.apache.org/jira/browse/CXF-7544
> Project: CXF
>  Issue Type: Bug
>Affects Versions: 3.1.13, 3.2.0
>Reporter: Andriy Redko
>Assignee: Andriy Redko
>
> The issue pop up as part of https://github.com/apache/cxf/pull/330 
> discussion. In case when provider / feature / resource is a proxied CDI bean, 
> the contextual class members (annotated with @Context) are not injected.
> Test case to reproduce:
> {code}
> @ApplicationScoped
> public class BookStoreRequestFilter implements ContainerRequestFilter {
> @Context private ResourceInfo resourceInfo;
> 
> @Override
> public void filter(ContainerRequestContext requestContext) throws 
> IOException {
> // Contextual instances should be injected independently
> if (resourceInfo == null || resourceInfo.getResourceMethod() == null) 
> {
> requestContext.abortWith(Response.serverError().build());
> }
> }
> }
> {code}
> CC [~rmannibucau]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CXF-7535) Support for Project Reactor as rx()

2017-10-29 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CXF-7535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224325#comment-16224325
 ] 

ASF GitHub Bot commented on CXF-7535:
-

johnament commented on issue #331: [CXF-7535] Adding client & server support 
for Project Reactor
URL: https://github.com/apache/cxf/pull/331#issuecomment-340328466
 
 
   Hi @deki thanks for the tip.  What profiles would you recommend?  note that 
I only have the jaxrs systests module open in my IDE, but can go back to the 
broader one.
   
   One other thing, i'm noticing that the settings jar from intellij doesn't 
put imports in the right order.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Support for Project Reactor as rx()
> ---
>
> Key: CXF-7535
> URL: https://issues.apache.org/jira/browse/CXF-7535
> Project: CXF
>  Issue Type: New Feature
>  Components: JAX-RS
>Affects Versions: 3.2.0
>Reporter: John D. Ament
>
> It would be good if Project Reactor was supported as an rx() type in CXF.  
> https://github.com/apache/cxf/tree/master/rt/rs/extensions/rx - only shows rx 
> java and rx java 2.  project reactor/reactor core seem like the v3's of this 
> api stack.
> https://projectreactor.io/



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)