Re: Karaf 4.4.0/Pax-Web 8.0.2 Tomcat context handling

2022-05-30 Thread Grzegorz Grzybek
Hello!

pon., 30 maj 2022 o 11:26 Siano, Stephan 
napisał(a):

> Hi Grzegorz,
>
> Thanks a lot, this looks great. I will try to test that as soon as I find
> the time for it.
>

If it's fine, then I'll do a 8.0.4 release.

regards
Grzegorz Grzybek


>
> Best regards
> Stephan
>
> -Original Message-
> From: Grzegorz Grzybek 
> Sent: Wednesday, 25 May 2022 13:05
> To: dev@karaf.apache.org
> Subject: Re: Karaf 4.4.0/Pax-Web 8.0.2 Tomcat context handling
>
> Hello
>
> wt., 24 maj 2022 o 15:28 Siano, Stephan 
> napisał(a):
>
> > Hi Grzegorz,
> >
> > > These are kind of inline dev notes. I can imagine that they may blur
> > > the
> > code, but I really tried to ensure that everything is consistent, so I
> > spent a lot of time reading the
> > > original Tomcat/Jetty/Undertow code and writing down some observations.
> > > This note just states what Tomcat itself is doing and it uses it for
> > $CATALINA_HOME/conf/context.xml file which is common to ALL web
> > applications. That's definitely
> > > something we DON'T want in Pax Web.
> >
> > Well, this global context.xml in Tomcat is for customizing all web
> > applications to the environment. This might as well be a use case for
> > the karaf container. Currently some of the stuff like authentication
> > configuration is hard-coded in the pax-web-tomcat coding, however we
> > need to find a way to customize this somehow...
> >
>
> I've created and fixed
>
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fops4j%2Forg.ops4j.pax.web%2Fissues%2F1723&data=05%7C01%7Cstephan.siano%40sap.com%7C617076115dd54a790a2708da3e3e63d6%7C42f7676cf455423c82f6dc2d99791af7%7C0%7C0%7C637890734929332755%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FvdjG0ax56a7L2t7pa07zB4Mj1knwRiM79L3CCgjc4A%3D&reserved=0
>
> I found i indeed useful, so I've added support for another PID
> configuration option - `org.ops4j.pax.web.context.file` If you install
> pax-web-http-jetty or pax-web-http-tomcat (no support for Undertow), you
> can configure a global "context configuration file" which
> matches:
>
>- for Jetty, the jetty-web.xml file documented in
>
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.eclipse.org%2Fjetty%2Fdocumentation%2Fjetty-9%2Findex.html%23using-basic-descriptor-files&data=05%7C01%7Cstephan.siano%40sap.com%7C617076115dd54a790a2708da3e3e63d6%7C42f7676cf455423c82f6dc2d99791af7%7C0%7C0%7C637890734929332755%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sssbzXtw3aykNaWivNHMTmj7BYEzUT8i3CpPpIVRvDs%3D&reserved=0
>- it was already handled from /WEB-INF/jetty-web.xml
>- for Tomcat, the tomcat-context.xml file documented in
>
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftomcat.apache.org%2Ftomcat-9.0-doc%2Fconfig%2Fcontext.html&data=05%7C01%7Cstephan.siano%40sap.com%7C617076115dd54a790a2708da3e3e63d6%7C42f7676cf455423c82f6dc2d99791af7%7C0%7C0%7C637890734929332755%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=0t4Ey84q3NKm0AAXkwx3f1q1nbXTzR%2BDvyFG4941HMg%3D&reserved=0
> - it was
>already handled from META-INF/context.xml - Tomcat reads it from
>$CATALINA_HOME/conf/context.xml
>
> These options are disabled by default, but I provide template versions of
> jetty-web.xml and tomcat-context.xml
>
> For example, tomcat-context.xml contains:
>
> 
> 
> 
>
> If you uncomment the valve and "org.ops4j.pax.web.context.file =
> ${karaf.etc}/tomcat-context.xml" option, the valve rejects request from non
> local addresses - I hope that's what you're looking for.
>
> kind regards
> Grzegorz Grzybek
>
>
> >
> > Best regards
> > Stephan
> >
> > -Original Message-
> > From: Grzegorz Grzybek 
> > Sent: Tuesday, 24 May 2022 11:44
> > To: dev@karaf.apache.org
> > Subject: Re: Karaf 4.4.0/Pax-Web 8.0.2 Tomcat context handling
> >
> > Hello
> >
> > wt., 24 maj 2022 o 09:59 Siano, Stephan
> > 
> > napisał(a):
> >
> > > Hi,
> > >
> > > I have been trying around with Karaf 4.4.0 with the pax-web-tomcat
> > > webcontainer in the last days. First of all I want to state that
> > > Grzegorz did a fantastic job with the Pax-Web refactoring!
> > >
> >
> > It was my pleasure refactoring ;) I'd never have written/designed
> > anything as complex as Pax Web in the first place, so big thanks to
> original authors!
> >
> >
> > > Nevertheless, I encountered a few issues with tomcat context.xml
> > handling.
> > >
> > > First of all prior versions of pax-web-tomcat were able to load a
> > > default context.xml from the same directory as the tomcat-server.xml.
> > > I am not sure how to proceed with this.
> > > The BundleWebApplication class in the pax-web-extender-war bundle
> > > contains the following comment:
> > > // additionally:
> > > //  - Tom

RE: Karaf 4.4.0/Pax-Web 8.0.2 Tomcat context handling

2022-05-30 Thread Siano, Stephan
Hi Grzegorz,

Thanks a lot, this looks great. I will try to test that as soon as I find the 
time for it.

Best regards
Stephan

-Original Message-
From: Grzegorz Grzybek  
Sent: Wednesday, 25 May 2022 13:05
To: dev@karaf.apache.org
Subject: Re: Karaf 4.4.0/Pax-Web 8.0.2 Tomcat context handling

Hello

wt., 24 maj 2022 o 15:28 Siano, Stephan 
napisał(a):

> Hi Grzegorz,
>
> > These are kind of inline dev notes. I can imagine that they may blur 
> > the
> code, but I really tried to ensure that everything is consistent, so I 
> spent a lot of time reading the
> > original Tomcat/Jetty/Undertow code and writing down some observations.
> > This note just states what Tomcat itself is doing and it uses it for
> $CATALINA_HOME/conf/context.xml file which is common to ALL web 
> applications. That's definitely
> > something we DON'T want in Pax Web.
>
> Well, this global context.xml in Tomcat is for customizing all web 
> applications to the environment. This might as well be a use case for 
> the karaf container. Currently some of the stuff like authentication 
> configuration is hard-coded in the pax-web-tomcat coding, however we 
> need to find a way to customize this somehow...
>

I've created and fixed
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fops4j%2Forg.ops4j.pax.web%2Fissues%2F1723&data=05%7C01%7Cstephan.siano%40sap.com%7C617076115dd54a790a2708da3e3e63d6%7C42f7676cf455423c82f6dc2d99791af7%7C0%7C0%7C637890734929332755%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FvdjG0ax56a7L2t7pa07zB4Mj1knwRiM79L3CCgjc4A%3D&reserved=0

I found i indeed useful, so I've added support for another PID configuration 
option - `org.ops4j.pax.web.context.file` If you install pax-web-http-jetty or 
pax-web-http-tomcat (no support for Undertow), you can configure a global 
"context configuration file" which
matches:

   - for Jetty, the jetty-web.xml file documented in
   
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.eclipse.org%2Fjetty%2Fdocumentation%2Fjetty-9%2Findex.html%23using-basic-descriptor-files&data=05%7C01%7Cstephan.siano%40sap.com%7C617076115dd54a790a2708da3e3e63d6%7C42f7676cf455423c82f6dc2d99791af7%7C0%7C0%7C637890734929332755%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sssbzXtw3aykNaWivNHMTmj7BYEzUT8i3CpPpIVRvDs%3D&reserved=0
   - it was already handled from /WEB-INF/jetty-web.xml
   - for Tomcat, the tomcat-context.xml file documented in
   
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftomcat.apache.org%2Ftomcat-9.0-doc%2Fconfig%2Fcontext.html&data=05%7C01%7Cstephan.siano%40sap.com%7C617076115dd54a790a2708da3e3e63d6%7C42f7676cf455423c82f6dc2d99791af7%7C0%7C0%7C637890734929332755%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=0t4Ey84q3NKm0AAXkwx3f1q1nbXTzR%2BDvyFG4941HMg%3D&reserved=0
 - it was
   already handled from META-INF/context.xml - Tomcat reads it from
   $CATALINA_HOME/conf/context.xml

These options are disabled by default, but I provide template versions of 
jetty-web.xml and tomcat-context.xml

For example, tomcat-context.xml contains:





If you uncomment the valve and "org.ops4j.pax.web.context.file = 
${karaf.etc}/tomcat-context.xml" option, the valve rejects request from non 
local addresses - I hope that's what you're looking for.

kind regards
Grzegorz Grzybek


>
> Best regards
> Stephan
>
> -Original Message-
> From: Grzegorz Grzybek 
> Sent: Tuesday, 24 May 2022 11:44
> To: dev@karaf.apache.org
> Subject: Re: Karaf 4.4.0/Pax-Web 8.0.2 Tomcat context handling
>
> Hello
>
> wt., 24 maj 2022 o 09:59 Siano, Stephan 
> 
> napisał(a):
>
> > Hi,
> >
> > I have been trying around with Karaf 4.4.0 with the pax-web-tomcat 
> > webcontainer in the last days. First of all I want to state that 
> > Grzegorz did a fantastic job with the Pax-Web refactoring!
> >
>
> It was my pleasure refactoring ;) I'd never have written/designed 
> anything as complex as Pax Web in the first place, so big thanks to original 
> authors!
>
>
> > Nevertheless, I encountered a few issues with tomcat context.xml
> handling.
> >
> > First of all prior versions of pax-web-tomcat were able to load a 
> > default context.xml from the same directory as the tomcat-server.xml.
> > I am not sure how to proceed with this.
> > The BundleWebApplication class in the pax-web-extender-war bundle 
> > contains the following comment:
> > // additionally:
> > //  - Tomcat handles context.xml 
> > files set by 
> > org.apache.catalina.core.StandardContext.setDefaultContextXml()
> >
>
> These are kind of inline dev notes. I can imagine that they may blur 
> the code, but I really tried to ensure that everything is consistent, 
> so I spent a lot of time reading the original Tomcat/