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

Mark Struberg commented on DELTASPIKE-1475:
-------------------------------------------

I'm not sure where the CDI-ctrl is involed in this scenario. You say you use 
Weld. How is Weld integrated with RestEasy in your setup? Usually those 2 JBoss 
libs integrate very deeply into each other, even without DeltaSpike. As you 
already use a newer Weld version you don't need to use the {{@DeltaSpike}} 
qualifier for injecting HttpServletRequests - the EG liked this DeltaSpike 
feature and this is now part of the CDI spec.

Of course if you start a new thread you won't have access to the 
ServletRequest, even with using the new CDI spec feature - because there is no 
such thing as a ServletRequest in the new thread. Thus closing as 
'not-a-problem'. txs

> CDI Container Control does not create HttpServletRequest
> --------------------------------------------------------
>
>                 Key: DELTASPIKE-1475
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1475
>             Project: DeltaSpike
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: CdiControl
>    Affects Versions: 1.9.6
>         Environment: EE8
> Tomcat 9.0.89
> Weld 3.1.9
> Resteasy 4.7.9
> Quartz 2.3.2
> Deltaspike-Scheduler 1.9.6
>            Reporter: df
>            Priority: Major
>              Labels: cdi, jax-rs, request, weld
>
> I get a "Attempt to access the request/response without an active HTTP 
> request" error in the following scenario:
>  * Application scoped bean with DeltaSpike Scheduler injection
>  * The bean calls: scheduler.registerNewJob(Worker.class)
>  * Worker runs a JAX-RS request
>  * An JAX-RS ClientRequestFilter and ClientResponseFilter filter is triggered 
> (annotated with @ApplicationScoped and @Provider)
>  * The filter has: @Inject @DeltaSpike Provider<HttpServletRequest> which 
> throws an error once the cdi provider is resolved
> --> error
>  
> Debugging notes:
>  * 
> org.apache.deltaspike.servlet.impl.produce.ServletObjectProducer#getHttpServletRequest
>  is called, but RequestResponseHolder.REQUEST.get() throws an error
>  * The WeldContextControl starts the Session and Request scopes but they only 
> seem to store a state in the RequestContextHolder ThreadLocal
> Do I miss something? It seems the context controller does not really start a 
> HttpServletRequest as the container would.
> Somehow the 
> org.apache.deltaspike.servlet.impl.produce.RequestResponseHolder#bind must be 
> called with an actual request. But how?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to