Hi Achim, I'll need a JIRA account, please.
As for the PR, I can do it as reference, but it was just a quick fix I've tried when digging a little bit on the issue. I'm not confident that it doesn't have any bad side effect. For instance, if the servlet name can be anything and not necessarily a path, why all that trouble ensuring it doesn't end in a forward slash unless it is just "/"? -- Nelson -- On Tuesday, May 23, 2017 at 7:53:51 PM UTC+1, Achim Nierbeck wrote: > > Hi Nelson, > > do you care about creating an Issue for this and maybe provide a pull > request? > if needed, a jira user can be created. > > > regards, Achim > > 2017-05-23 14:45 GMT+02:00 Nelson Antunes <[email protected] > <javascript:>>: > >> That call to registerResources in [1 >> <https://github.com/ops4j/org.ops4j.pax.web/blob/web-3.2.9/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/element/ResourceWebElement.java#L56-L57>] >> >> is part of the org.osgi.service.http.HttpService interface. >> >> I noticed the servlet name (at least the one listed with the http:list >> command) is set here [2 >> <https://github.com/ops4j/org.ops4j.pax.web/blob/web-3.2.9/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerImpl.java#L219>] >> >> (for Jetty). >> So I tried to modify that model name. [3 >> <https://github.com/ops4j/org.ops4j.pax.web/blob/web-3.2.9/pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceStarted.java#L253-L254>] >> >> seemed a good place to try. >> >> I changed it to: >> >> String modelName = "bundle:" + contextModel.getBundle().getBundleId(); >> if(!"/".equals(name)) { >> modelName += name; >> } >> final ResourceModel model = new ResourceModel(contextModel, servlet, alias, >> modelName ); >> >> >> Now http:list show all the expected servlets and the resources are >> served from different bundles with the same internal resource paths. >> They also get correctly undeployed when stopping the bundles. >> >> But I can't be sure of any side-effects. >> >> (tested in tag web-3.2.9, but the code is still the same in the master >> branch) >> >> -- Nelson -- >> >> [1] >> https://github.com/ops4j/org.ops4j.pax.web/blob/web-3.2.9/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/element/ResourceWebElement.java#L56-L57 >> [2] >> https://github.com/ops4j/org.ops4j.pax.web/blob/web-3.2.9/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerImpl.java#L219 >> [3] >> https://github.com/ops4j/org.ops4j.pax.web/blob/web-3.2.9/pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceStarted.java#L253-L254 >> >> >> On Thursday, February 23, 2017 at 9:14:01 PM UTC, Nick Baker wrote: >>> >>> Hello All, >>> >>> We're experiencing an issue with bundles supplying Resource mappings. It >>> appears that the internal path within the bundle is used as the servlet >>> name [1]. Unfortunately, our teams love standards and conventions so >>> they're using a "web" folder for all bundles supplying Resources. This was >>> discovered on 3.1.4 but I've verified that the situation still exists in >>> master. >>> >>> PAX-Web appropriately doesn't allow multiple servlets of the same name >>> so we're loosing some resources upon startup of Karaf. The short-term >>> solution for us was to ensure that each internal bundle path is unique. A >>> better solution would be to modify PAX to create a composite key of >>> bundle-id + path when creating the resource Servlet names. >>> >>> [1] >>> https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/element/ResourceWebElement.java#L57-L57 >>> >>> -Nick Baker >>> >> -- >> -- >> ------------------ >> OPS4J - http://www.ops4j.org - [email protected] <javascript:> >> >> --- >> 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 [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > Apache Member > Apache Karaf <http://karaf.apache.org/> Committer & PMC > OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & > Project Lead > blog <http://notizblog.nierbeck.de/> > Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS> > > Software Architect / Project Manager / Scrum Master > > -- -- ------------------ OPS4J - http://www.ops4j.org - [email protected] --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
