afs commented on code in PR #3940:
URL: https://github.com/apache/jena/pull/3940#discussion_r3294077997


##########
jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java:
##########
@@ -1839,8 +1838,22 @@ private void servletsAndFilters(ServletContextHandler 
context) {
             if ( staticContentDir != null ) {
                 DefaultServlet staticServlet = new DefaultServlet();
                 ServletHolder staticContent = new ServletHolder(staticServlet);
-                staticContent.setInitParameter("baseResource", 
staticContentDir);
                 //staticContent.setInitParameter("cacheControl", "false");
+                if ( staticContentDir.startsWith("jar:") ) {

Review Comment:
   ```suggestion
                   // << Jetty 12.1.9 issue
                   // When a fixed Jetty is available, replace block with   
staticContent.setInitParameter("baseResource", staticContentDir);
                   if ( staticContentDir.startsWith("jar:") ) {
   ```



##########
jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java:
##########
@@ -1839,8 +1838,22 @@ private void servletsAndFilters(ServletContextHandler 
context) {
             if ( staticContentDir != null ) {
                 DefaultServlet staticServlet = new DefaultServlet();
                 ServletHolder staticContent = new ServletHolder(staticServlet);
-                staticContent.setInitParameter("baseResource", 
staticContentDir);
                 //staticContent.setInitParameter("cacheControl", "false");
+                if ( staticContentDir.startsWith("jar:") ) {
+                    staticContent.setInitParameter("baseResource", 
staticContentDir);
+                } else {
+                    try {
+                        // Use URLResourceFactory instead of 
ResourceFactory.of(context) (which yields PathResource)
+                        // to work around a Windows bug in Jetty 12.1.9 
PathResource.resolve(URI) where
+                        // path.resolve(uri.getPath()) fails for absolute 
Windows paths.
+                        // See: 
https://github.com/jetty/jetty.project/pull/15020
+                        java.net.URL url = 
Path.of(staticContentDir).toUri().toURL();
+                        Resource base = new 
org.eclipse.jetty.util.resource.URLResourceFactory().newResource(url);
+                        context.setBaseResource(base);
+                    } catch (MalformedURLException e) {
+                        staticContent.setInitParameter("baseResource", 
staticContentDir);
+                    }
+                }

Review Comment:
   ```suggestion
                   }
                   //  >> Jetty 12.1.9 issue
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to