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.

Reply via email to