Hello czw., 14 lip 2022 o 15:05 Richard Hierlmeier <rhierlme...@googlemail.com> napisał(a):
> How can I define the ServletContextHelper for a WAB? I can not find any > hint in the R7 spec. > You ... can't. There's nothing at all about ServletContextHelper concept (Whiteboard) in chapter 128 (WABs). Pax Web 8 explicitly defines special class org.ops4j.pax.web.extender.war.internal.WebApplicationHelper, which extends org.ops4j.pax.web.service.spi.context.DefaultServletContextHelper which extends org.osgi.service.http.context.ServletContextHelper. Such implementation is specially crafted to: - provide org.osgi.service.http.context.ServletContextHelper - handle WAR scenarios related to resource access It is then set inside org.ops4j.pax.web.service.spi.model.OsgiContextModel - a common "context" representation for HttpService, Whiteboard and WAB scenarios. Out of curiosity - do you have any special requirement that a WAB needs custom context? Mind that org.osgi.service.http.context.ServletContextHelper in Whiteboard has two responsibilities: - security (WABs/WARs have better ways to deal with this) - resource access (WABs/WARs have standard resource access methods defined in the Servlets specification itself) regards Grzegorz Grzybek > > Richard > > Am Mo., 27. Juni 2022 um 16:15 Uhr schrieb Grzegorz Grzybek < > gr.grzy...@gmail.com>: > >> Hi >> >> >> pon., 27 cze 2022 o 16:04 Richard Hierlmeier <rhierlme...@googlemail.com> >> napisał(a): >> >>> Hi Grzegorz. >>> >>> thank you for clarification. Unfortunately I can not upgrade to Karaf >>> 4.4 the next time. >>> What would happen when I define the session cookie name in jetty.xml and >>> not in the wab? >>> >> >> To answer more precisely, I'd have to check your current configuration - >> what WAB are you deploying and what are the registration properties of the >> HttpWhiteboard servlet. Only then I could check (going back to Karaf 4.3.7) >> what may be the issue related to context configuration... >> >> regards >> Grzegorz Grzybek >> >> >>> >>> >>> Richard >>> >>> >>> Am Mo., 27. Juni 2022 um 12:02 Uhr schrieb Grzegorz Grzybek < >>> gr.grzy...@gmail.com>: >>> >>>> Hello >>>> >>>> Unfortunately, only with Pax Web 8 (used in Karaf 4.4+) we've >>>> refactored the WAB/HttpService/Whiteboard inter operation. Pax Web 8 allows >>>> mixing web elements coming from different "origins" (whiteboard >>>> registration, direct registration using HttpService or >>>> web.xml/web-fragment.xml approach from WABs). >>>> >>>> So in Pax Web 8 you should be able to reconfigure the session cookie >>>> name and there servlets registered using Whiteboard targetting the same >>>> context (as in WAB) should use the same session configuration. >>>> >>>> Also - Pax Web 8 implements correctly the session separation mentioned >>>> in >>>> https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#service.http.whiteboard.servletcontext >>>> : >>>> >>>> Http Sessions are not shared amongst servlets registered with different >>>>> ServletContextHelpers. That is, HttpRequest.getSession calls must provide >>>>> different sessions per associated ServletContextHelper >>>>> >>>> >>>> So even if two whiteboard servlets are registered to the same target >>>> servlet context, but using different ServletContextHelper, they'll use >>>> different session configuration. >>>> >>>> kind regards >>>> Grzegorz Grzybek >>>> >>>> pon., 27 cze 2022 o 11:33 Richard Hierlmeier < >>>> rhierlme...@googlemail.com> napisał(a): >>>> >>>>> >>>>> My application runs in Karaf 4.3.7. I have a web application that is >>>>> deployed as wab application bundle (wab). This web application changes the >>>>> session cookie name in >>>>> javax.servlet.ServletContextListener#contextInitialized(). >>>>> >>>>> In another bundle I have a servlet that is defined with HttpWhiteBoard. >>>>> The servlets from the wab and the servlets from HttpWhiteBoard have >>>>> different http sessions (because they have different session cookie names >>>>> in the ServletContext). >>>>> >>>>> Is it possible to configure the session cookie for Servlets that are >>>>> deployed via HttpWhiteBoard? >>>>> >>>>> Regards >>>>> >>>>> Richard >>>>> >>>>>