AmshikaH commented on PR #816:
URL: https://github.com/apache/tomcat/pull/816#issuecomment-2636564607

   > These are names not paths.
   >
   > I'm not convinced that 'relative' and 'absolute' are concepts that apply 
here.
   
   As per the [Java documentation for resource 
names](https://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html?utm_source=chatgpt.com#res_names),
 "relative" and "absolute" do appear to be terminology that can be used in 
relation to a resource name, though not in the conventional sense.
   
   However, let me re-phrase how I refer to them in my comments:
   
   - absolute name: a resource name that starts with a `/`
   - relative name: a resource name that does not start with a `/`
   
   > Putting that to one side, where is the target resource located so that the 
'absolute' lookup fails but the 'relative' one works? 
   
   The resource is found within the cxf-core-3.5.9.jar as 
`cxf-core-3.5.9.jar!/org/apache/cxf/version/version.properties`. 
   
   The cxf jar is located outside the webapp in an external repository 
previously added via the addURL method in line 2536:
   
   
https://github.com/apache/tomcat/blob/9651aa96ae6d6c64fafddc8a9e48e5cafc791f4d/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L2536
   
   When the cxf jar is present in an external repository, the 'absolute' lookup 
using the resource name that starts with a `/` fails and returns a null stream 
and the 'relative' lookup without the leading slash succeeds (for versions 
9.0.96 and below) by getting the resource at line 1109 within the if block for 
external repositories: 
https://github.com/apache/tomcat/blob/9651aa96ae6d6c64fafddc8a9e48e5cafc791f4d/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1109
   
   > Also, relative to what? 
   
   My use of 'absolute' and 'relative' here have not been used in the 
conventional sense, but rather are used to indicate the presence of the leading 
slash similar to how it has been referred in the [Java documentation for 
resource 
names](https://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html?utm_source=chatgpt.com#res_names).
   
   However, if we were to use it in the conventional sense, I suppose it would 
be relative to the external repository?
   
   > What would be the 'absolute' path be that did work?
   
   If this cxf jar is present in the webapp's WEB-INF/lib folder, the lookup 
with the 'absolute' name starting with `/` succeeds by getting the resource at 
line 1102 itself: 
https://github.com/apache/tomcat/blob/9651aa96ae6d6c64fafddc8a9e48e5cafc791f4d/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L1102


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to