Re: [PAX WEB] Unique ID for ServletEvent

2020-02-26 Thread 'Achim Nierbeck' via OPS4J
Hi,

yes sounds like a "corner" case I didn't think of when implementing the
karaf commands and making sure the servlet events where according to the
spec.
thanks for pointing that out.

regards, Achim


Am Mi., 26. Feb. 2020 um 11:27 Uhr schrieb Grzegorz Grzybek <
gr.grzy...@gmail.com>:

> Hello
>
> Thanks for the analysis. I've created
> https://ops4j1.jira.com/browse/PAXWEB-1253 to track this issue.
>
> I'm in the process of OSGi CMPN R7 implementation in Pax Web 8 and the
> model has changed slightly (servlet model may be associated with more osgi
> context models / servlet context models), so I need to reflect this change
> in Karaf commands as well...
>
> regards
> Grzegorz Grzybek
>
> sob., 8 lut 2020 o 02:19 Miroslav Beranič 
> napisał(a):
>
>> Hi all,
>>
>> I am back at the existing PAX Web Whiteboard sample, located at:
>>
>> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/whiteboard-extended/src/main/java/org/ops4j/pax/web/extender/samples/whiteboard/internal/Activator.java
>>
>> In the example HttpContextMapping service has different name, all four of
>> them; also all four related URL Patterns are all different from each other
>> - /whiteboard, /whiteboard2, and /whiteboard3, /whiteboard4.
>> For now, let's say there are only two with context path defined - foo and
>> bar.
>>
>> When deployed in Karaf and checked from inside Karaf shell with command
>> http:list it prints all of the endpoints, but the Context path ( prefix )
>> is missing.
>>
>> It just lists endpoints without the context path. Before you start to
>> say, this is a problem inside Karaf, let me explain.
>>
>> If we imagine for the moment, if one would change/align all the endpoint
>> URL Patterns to the same url pattern = /whiteboard, the expected output
>> would be something/exactly like this:
>>
>> /foo/whiteboard
>> /bar/whiteboard
>>
>> but it is not, it is just one line with endpoint:
>>
>> /whiteboard
>>
>> I've checked Karaf's source code, and this is a topic for another mailing
>> list, but for now what I can say is -- the client ( in this case Karaf )
>> can not tell one servlet event from another.
>>
>> Because there is no "unique id" to distinguish one from another, when it
>> goes from one state to another. I would say, this is a root cause for how
>> Karaf ( incorrectly ) handles Servlet list.
>>
>> I would recommend that the already existing ID from ServletModel is
>> re-used, in a way, that additional field is added to the ServletEvent class
>> as final and set in the constructor ( final String id ). This has to be
>> updated in one place only - class HttpServiceStarted, in
>> method servletEvent, where servlet event is created from servlet model.
>>
>> I've changed this and with some minor updates in Karaf, I can see
>> different endpoints.
>>
>> /foo/whiteboard
>> /bar/whiteboard
>>
>> In Karaf, Servlet Events are stored in a map, by servlet name as a key.
>> Here is just a short rundown of some other updates I've done, but this is
>> for Karaf mailing list. But all was routed from this, that there is no way,
>> to identify one Servlet event from another - if they have the same Servlet
>> name and alias or url pattern -- but they are not the same, as the context
>> path is different.
>>
>> I ask here if this sounds like a valid solution/path or do you guys have
>> some other ways to go about this? If this sounds ok to you, I would be glad
>> to share my code changes.
>>
>> Apache Karaf 4.3.0
>> PAX Web 7.2.13 ( but the code is the same in the master branch also )
>>
>>
>> Kind Regards,
>> Miroslav
>>
>>
>>
>> --
>> Miroslav Beranič
>> MIBESIS
>> miroslav.bera...@mibesis.si
>> https://www.mibesis.si
>>
>> --
>> --
>> --
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ops4j+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ops4j/CA%2B3Fds5EK8HaNU%3D3e32JxkO8StRjfCRhJ_vP-YVyD4LSPN405A%40mail.gmail.com
>> 
>> .
>>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/CAAdXmhpaHoRbMK9iQtMG8iM6GkbZjtwb%3De4G2B-8%3DfRyJDGpAQ%40mail.gmail.com
> 
> .
>


-- 

Apache Member
Apache Karaf 

Re: [PAX WEB] Unique ID for ServletEvent

2020-02-26 Thread Grzegorz Grzybek
Hello

Thanks for the analysis. I've created
https://ops4j1.jira.com/browse/PAXWEB-1253 to track this issue.

I'm in the process of OSGi CMPN R7 implementation in Pax Web 8 and the
model has changed slightly (servlet model may be associated with more osgi
context models / servlet context models), so I need to reflect this change
in Karaf commands as well...

regards
Grzegorz Grzybek

sob., 8 lut 2020 o 02:19 Miroslav Beranič 
napisał(a):

> Hi all,
>
> I am back at the existing PAX Web Whiteboard sample, located at:
>
> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/whiteboard-extended/src/main/java/org/ops4j/pax/web/extender/samples/whiteboard/internal/Activator.java
>
> In the example HttpContextMapping service has different name, all four of
> them; also all four related URL Patterns are all different from each other
> - /whiteboard, /whiteboard2, and /whiteboard3, /whiteboard4.
> For now, let's say there are only two with context path defined - foo and
> bar.
>
> When deployed in Karaf and checked from inside Karaf shell with command
> http:list it prints all of the endpoints, but the Context path ( prefix )
> is missing.
>
> It just lists endpoints without the context path. Before you start to say,
> this is a problem inside Karaf, let me explain.
>
> If we imagine for the moment, if one would change/align all the endpoint
> URL Patterns to the same url pattern = /whiteboard, the expected output
> would be something/exactly like this:
>
> /foo/whiteboard
> /bar/whiteboard
>
> but it is not, it is just one line with endpoint:
>
> /whiteboard
>
> I've checked Karaf's source code, and this is a topic for another mailing
> list, but for now what I can say is -- the client ( in this case Karaf )
> can not tell one servlet event from another.
>
> Because there is no "unique id" to distinguish one from another, when it
> goes from one state to another. I would say, this is a root cause for how
> Karaf ( incorrectly ) handles Servlet list.
>
> I would recommend that the already existing ID from ServletModel is
> re-used, in a way, that additional field is added to the ServletEvent class
> as final and set in the constructor ( final String id ). This has to be
> updated in one place only - class HttpServiceStarted, in
> method servletEvent, where servlet event is created from servlet model.
>
> I've changed this and with some minor updates in Karaf, I can see
> different endpoints.
>
> /foo/whiteboard
> /bar/whiteboard
>
> In Karaf, Servlet Events are stored in a map, by servlet name as a key.
> Here is just a short rundown of some other updates I've done, but this is
> for Karaf mailing list. But all was routed from this, that there is no way,
> to identify one Servlet event from another - if they have the same Servlet
> name and alias or url pattern -- but they are not the same, as the context
> path is different.
>
> I ask here if this sounds like a valid solution/path or do you guys have
> some other ways to go about this? If this sounds ok to you, I would be glad
> to share my code changes.
>
> Apache Karaf 4.3.0
> PAX Web 7.2.13 ( but the code is the same in the master branch also )
>
>
> Kind Regards,
> Miroslav
>
>
>
> --
> Miroslav Beranič
> MIBESIS
> miroslav.bera...@mibesis.si
> https://www.mibesis.si
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/CA%2B3Fds5EK8HaNU%3D3e32JxkO8StRjfCRhJ_vP-YVyD4LSPN405A%40mail.gmail.com
> 
> .
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CAAdXmhpaHoRbMK9iQtMG8iM6GkbZjtwb%3De4G2B-8%3DfRyJDGpAQ%40mail.gmail.com.


[PAX WEB] Unique ID for ServletEvent

2020-02-07 Thread Miroslav Beranič
Hi all,

I am back at the existing PAX Web Whiteboard sample, located at:
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/whiteboard-extended/src/main/java/org/ops4j/pax/web/extender/samples/whiteboard/internal/Activator.java

In the example HttpContextMapping service has different name, all four of
them; also all four related URL Patterns are all different from each other
- /whiteboard, /whiteboard2, and /whiteboard3, /whiteboard4.
For now, let's say there are only two with context path defined - foo and
bar.

When deployed in Karaf and checked from inside Karaf shell with command
http:list it prints all of the endpoints, but the Context path ( prefix )
is missing.

It just lists endpoints without the context path. Before you start to say,
this is a problem inside Karaf, let me explain.

If we imagine for the moment, if one would change/align all the endpoint
URL Patterns to the same url pattern = /whiteboard, the expected output
would be something/exactly like this:

/foo/whiteboard
/bar/whiteboard

but it is not, it is just one line with endpoint:

/whiteboard

I've checked Karaf's source code, and this is a topic for another mailing
list, but for now what I can say is -- the client ( in this case Karaf )
can not tell one servlet event from another.

Because there is no "unique id" to distinguish one from another, when it
goes from one state to another. I would say, this is a root cause for how
Karaf ( incorrectly ) handles Servlet list.

I would recommend that the already existing ID from ServletModel is
re-used, in a way, that additional field is added to the ServletEvent class
as final and set in the constructor ( final String id ). This has to be
updated in one place only - class HttpServiceStarted, in
method servletEvent, where servlet event is created from servlet model.

I've changed this and with some minor updates in Karaf, I can see different
endpoints.

/foo/whiteboard
/bar/whiteboard

In Karaf, Servlet Events are stored in a map, by servlet name as a key.
Here is just a short rundown of some other updates I've done, but this is
for Karaf mailing list. But all was routed from this, that there is no way,
to identify one Servlet event from another - if they have the same Servlet
name and alias or url pattern -- but they are not the same, as the context
path is different.

I ask here if this sounds like a valid solution/path or do you guys have
some other ways to go about this? If this sounds ok to you, I would be glad
to share my code changes.

Apache Karaf 4.3.0
PAX Web 7.2.13 ( but the code is the same in the master branch also )


Kind Regards,
Miroslav



-- 
Miroslav Beranič
MIBESIS
miroslav.bera...@mibesis.si
https://www.mibesis.si

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/CA%2B3Fds5EK8HaNU%3D3e32JxkO8StRjfCRhJ_vP-YVyD4LSPN405A%40mail.gmail.com.