<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello,<br>
<br>
please see inline.<br>
<br>
On 05/12/14 23:02, arjan tijms wrote:<br>
</div>
<blockquote
cite="mid:CAE=-AhDV8R=SKDEjyqiD+B_iOJe5rc7bh+gp2nSaONPT5hBZvg@mail.gmail.com"
type="cite">On Friday, December 5, 2014, Pavel Bucek <<a
moz-do-not-send="true" href="mailto:pavel.bucek@oracle.com">pavel.bucek@oracle.com</a>>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On 04/12/14 10:04, Martin Kouba wrote:<br>
> Dne 4.12.2014 v 09:28 Pavel Bucek napsal(a):<br>
>><br>
>> On 03/12/14 19:44, arjan tijms wrote:<br>
>>><br>
>>> On Wednesday, December 3, 2014, Pavel Bucek <<a
moz-do-not-send="true" href="javascript:;" onclick="_e(event,
'cvml', 'pavel.bucek@oracle.com')">pavel.bucek@oracle.com</a><br>
>>> <mailto:<a moz-do-not-send="true"
href="javascript:;" onclick="_e(event, 'cvml',
'pavel.bucek@oracle.com')">pavel.bucek@oracle.com</a>>>
wrote:<br>
>>><br>
>>> I'm trying to figure out how to solve issue in
JSR 356 - Java API for<br>
>>> WebSocket, related to CDI scope usable from
WebSocket endpoints.<br>
>>> Problem<br>
>>> is, that "standard" scopes do not apply,
because there is no<br>
>>> @RequestScoped (http response is already
sent), HttpSession does not<br>
>>> need to be created and the rest does not seem
to be applicable, ...<br>
>>><br>
>>> I believe that CDI specification should define
@UpgradeScoped, which<br>
>>> would cover usages of HttpUpgradeHandler from
Servlet API.<br>
>>> (Similarly as<br>
>>> it does for @RequestScoped, @SessionScoped,
... )<br>
>>><br>
>>><br>
>>> Wouldn't it be a better option to have WebSocket
define that scope,<br>
>>> using CDI to implement it?<br>
>> That is one possibility, but @UpgradeScoped would be
more general than<br>
>> just for WebSocket - it would apply for all HTTP/1.1+
Upgrade<br>
>> applications. In my eyes, it is something which was
forgotten to do in<br>
>> Java EE 7 release, since HttpUpgradeHandler was
introduced in it.<br>
>><br>
>> Also please note, that other Servlet related scopes are
already in CDI<br>
>> spec, so it seems like it belongs there more than
anywhere else. This<br>
>> might have multiple reasons - for example, you can
easily define<br>
>> relationship between @UpgradeScoped and others, already
existing ones.<br>
>> In this sense, CDI specification now depends on Servlet
API (it<br>
>> references some of the classes defined in it), but
Servlet does not do<br>
>> that for CDI. I don't think that Servlet spec should
introduce similar<br>
>> dependency just because of new scope.<br>
> That's a good point. However, I don't think it's a good
path to follow.<br>
> I mean if it were in CDI spec, CDI implementations would be
required to<br>
> implement this. However, Servlet spec is not very clear in
many areas<br>
> and doesn't always provide a powerful enough SPI. Even now
there are<br>
> technical issues with similar requirements (e.g.
@RequestScoped during<br>
> AsyncListener invocations). I'm not so sure about
HttpUpgradeHandler<br>
> though...<br>
<br>
And what if the @UpgradeScoped definition would need to state
something<br>
like "this scope is part of @ApplicationScoped"? That would
result even<br>
in more confusion and cross references CDI to Servlet and vice
versa.</blockquote>
<div><br>
</div>
<div>I'm not so sure that would necessarily be confusing. If
Servlet is "layered" on top of CDI, then a scope in Servlet
could reference other things within the Servlet spec, or things
in lower layers, which is CDI in this case.</div>
<div><br>
</div>
<div>There would be no cross-references there, would there?</div>
</blockquote>
<br>
well.. I'm not the expert in Servlet nor CDI spec, but what I see in
Servlet is NOT related to CDI directly. Simple search does not
include any "RequestScoped" appearance. There is only brief
reference to it in chapter 15.5.15, but that refers only to Java EE
7 umbrella specification definition. So, from my point of view,
Servlet DOES NOT depend on CDI.<br>
<br>
On the other hand, CDI specification references directly to Servlet
classes/methods in multiple chapters: 3.8, 5.5.2, 5.5.3, 6.7.1,
6.7.2, 6.7.3, 6.7.4, ... . <br>
<br>
Please note that I'm using last released versions of spec documents
- Servlet 3.1 and CDI 1.2.<br>
<br>
<br>
<blockquote
cite="mid:CAE=-AhDV8R=SKDEjyqiD+B_iOJe5rc7bh+gp2nSaONPT5hBZvg@mail.gmail.com"
type="cite">
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">I could see
this being part of Servlet spec only if all other<br>
"Servlet-related" scopes are there as well.</blockquote>
<div><br>
</div>
<div>Correct me if I'm wrong, but there's only one scope in CDI
that at the moment exclusively references Servlet, and that's
@SessionScoped.</div>
<div><br>
</div>
<div>Both @RequestScoped and @ApplicationScoped have a
(much) broader definition than being just a Servlet scope.</div>
<div><br>
</div>
<div>I'm not entirely sure, but the way these 3 scopes are now set
up may not exclude @SessionScoped being applied to other things
as well.</div>
</blockquote>
<br>
Same for @UpgradeScoped - it might be applied to other things as
well (little bit far fetched from my side, I know - @SessionScoped
is much more general than @UpgradeScoped).<br>
<br>
<blockquote
cite="mid:CAE=-AhDV8R=SKDEjyqiD+B_iOJe5rc7bh+gp2nSaONPT5hBZvg@mail.gmail.com"
type="cite">
<div>The one problem may be that CDI here lists all other specs
that give meaning to the scope. Even though it's just text and
not an actual API dependency, this may not be entirely
consistent (but how could it be done better?)</div>
</blockquote>
<br>
That is not exactly correct - CDI spec defines how these scopes
should be implemented - it *gives* the meaning to the scopes (at
least in this case) in other specifications (see my note about no
@*Scoped references in Servlet spec).<br>
<br>
Please don't take this as "@UpgradeScoped" must be introduced and it
must be in CDI spec. I'm just trying to see where it should be and
currently I think it should be near other scope definitions. As I
said, I can start similar discussion with Servlet spec group, but it
would be nice to have some conclusion from here..<br>
<br>
Thanks and regards,<br>
Pavel<br>
<br>
<blockquote
cite="mid:CAE=-AhDV8R=SKDEjyqiD+B_iOJe5rc7bh+gp2nSaONPT5hBZvg@mail.gmail.com"
type="cite">
<div><br>
</div>
<div>Kind regards,</div>
<div>Arjan Tijms</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Con somebody suggest what should I do next? I can file an issue
against<br>
CDI spec and even against Servlet spec, but my feeling is that
it might<br>
be deferred on both issue trackers as "not in scope, it should
be done<br>
somewhere else". I know I already asked, but - is there any
discussion<br>
between CDI and Servlet spec leads about this topic?<br>
<br>
Thanks and regards,<br>
Pavel<br>
<br>
_______________________________________________<br>
cdi-dev mailing list<br>
<a moz-do-not-send="true" href="javascript:;" onclick="_e(event,
'cvml', 'cdi-dev@lists.jboss.org')">cdi-dev@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/cdi-dev"
target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
<br>
Note that for all code provided on this list, the provider
licenses the code under the Apache License, Version 2 (<a
moz-do-not-send="true"
href="http://www.apache.org/licenses/LICENSE-2.0.html"
target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>).
For all other ideas provided on this list, the provider waives
all patent and other intellectual property rights inherent in
such information.<br>
</blockquote>
</blockquote>
<br>
</body>
</html>