You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@openwebbeans.apache.org by Harald Wellmann <hw...@gmail.com> on 2012/08/30 19:58:14 UTC
Request context in Java SE
In a multi-threaded Java SE application, how can I make sure that a CDI
request context is started for every thread?
As far as I can see, a request context is only available on the thread
that created the CDI container (WebBeansContext).
Is there a portable way of starting the contexts (i.e without depending
on OWB APIs)?
If not, will this be addressed in CDI 1.1?
Best regards,
Harald
Re: Request context in Java SE
Posted by Harald Wellmann <hw...@gmail.com>.
Thanks, I'll try that. But I'd really love to see a standard API for that...
Looks like this is part of https://issues.jboss.org/browse/CDI-174,
but there doesn't seem to be much activity.
Best regards,
Harald
2012/8/31 Mark Struberg <st...@yahoo.de>:
> After starting a new thread you must start a ReqeustContext for it manually.
>
> There is not yet an API for it, but you can do this in a portable way with Apache DeltaSpike CdiControl.
>
> Just
> @Inject ContextControl ctxCtrl.
>
> and invoke
> ctxCtrl.startContext(RequestScoped.class);
>
> and it should work.
>
Re: Request context in Java SE
Posted by Mark Struberg <st...@yahoo.de>.
Hi Harald!
After starting a new thread you must start a ReqeustContext for it manually.
There is not yet an API for it, but you can do this in a portable way with Apache DeltaSpike CdiControl.
Just
@Inject ContextControl ctxCtrl.
and invoke
ctxCtrl.startContext(RequestScoped.class);
and it should work.
LieGrue,
strub
----- Original Message -----
> From: Harald Wellmann <hw...@gmail.com>
> To: user@openwebbeans.apache.org
> Cc:
> Sent: Thursday, August 30, 2012 7:58 PM
> Subject: Request context in Java SE
>
> In a multi-threaded Java SE application, how can I make sure that a CDI request
> context is started for every thread?
>
> As far as I can see, a request context is only available on the thread that
> created the CDI container (WebBeansContext).
>
> Is there a portable way of starting the contexts (i.e without depending on OWB
> APIs)?
>
> If not, will this be addressed in CDI 1.1?
>
> Best regards,
> Harald
>