Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I configure embedded Jetty to serve webjars? #12128

Closed
kshep92 opened this issue Aug 2, 2024 · 11 comments · Fixed by #12130
Closed

How do I configure embedded Jetty to serve webjars? #12128

kshep92 opened this issue Aug 2, 2024 · 11 comments · Fixed by #12130
Labels

Comments

@kshep92
Copy link

kshep92 commented Aug 2, 2024

Jetty Version
12.0.10

Jetty Environment

ee10

Java Version
17

Question
I'm attempting to serve WebJars using embedded Jetty with the following configuration:

/* WebJars */
ServletContextHandler webJarsContext = new ServletContextHandler("/webjars");
var resourceHandler = new ResourceHandler();
resourceHandler.setBaseResource(ResourceFactory.of(webJarsContext).newClassLoaderResource("META-INF/resources/webjars/", true));
webJarsContext.setHandler(resourceHandler);

I've included Bootstrap as a WebJar dependency in my Gradle file:

implementation("org.webjars:bootstrap:5.2.3")

However, when I visit /webjars/bootstrap/5.2.3/css/bootstrap.css I get a 404. However, If I put a file in my project's src/main/resources/META-INF/resources/webjars directory, it gets served.

What is wrong with my configuration?

@kshep92
Copy link
Author

kshep92 commented Aug 2, 2024

Update: It appears that if you have a src/main/resources/META-INF/resources/webjars directory as part of your project's resources, calling ResourceFactory.of(webJarsContext).newClassLoaderResource("META-INF/resources/webjars/") will see that directory in your build output and will ignore the other WebJar directories on the Classpath. I'm not sure if this is a bug or an intended feature, but the solution appears to be to remove any META-INF/resources/webjars directories from your project.

@gregw
Copy link
Contributor

gregw commented Aug 2, 2024

@kshep92 I'm not exactly sure what you are trying to achieve with:

resourceHandler.setBaseResource(ResourceFactory.of(webJarsContext).newClassLoaderResource("META-INF/resources/webjars/", true));

That is looking through all the jars on your class path for any that contain a "META-INF/resources/webjars/" directory and making that the docroot of your context. Is that what you intend? i.e. you want static content to be served from your classpath?
If there are multiple "META-INF/resources/webjars/" on the classpath, then you should get back a combined resource that contains them all. Is that what you want?

Oh I think I see a bug in newClassLoaderResource where it is not handling directories correctly. So if you do want a combined directory resource containing a merge of all the "META-INF/resources/webjars/", then I think we might need to fix that bug before that will work.

@kshep92
Copy link
Author

kshep92 commented Aug 2, 2024

@gregw

That is looking through all the jars on your class path for any that contain a "META-INF/resources/webjars/" directory and making that the docroot of your context. Is that what you intend? i.e. you want static content to be served from your classpath?

I believe that is how WebJars are supposed to work, but I am open for correction if this is not the correct way to go about this.

@gregw
Copy link
Contributor

gregw commented Aug 2, 2024

@kshep92 for this conversation, you are the webjars expert! So if you are expecting newClassLoaderResource to return a Resource that might be the combination of multiple directories.... then that is a good expectation to have, but we have a bug and will not return that. I'm working on a fix. Once the fix is available I'll probably be able to give you a code snippet to work with the current release as well.

@kshep92
Copy link
Author

kshep92 commented Aug 2, 2024

Thank you very much.

gregw added a commit that referenced this issue Aug 2, 2024
Fix #12104 by returning a CombinedResource for a ClassLoader resource that has multiple directory matches.
@gregw
Copy link
Contributor

gregw commented Aug 2, 2024

@kshep92 See PR #12130. You can probably grab the method and inline it in your code to test it out.

@kshep92
Copy link
Author

kshep92 commented Aug 2, 2024

@gregw awesome! I'll check it out.

@joakime
Copy link
Contributor

joakime commented Aug 2, 2024

Here's a few real world examples of webjars ...

$ jar -tvf jquery-3.6.4.jar | grep webjars
     0 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/
     0 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/jquery/
     0 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/jquery/3.6.4/
138351 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/jquery/3.6.4/jquery.min.map
292458 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/jquery/3.6.4/jquery.js
   204 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/jquery/3.6.4/webjars-requirejs.js
110701 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/jquery/3.6.4/jquery.slim.min.map
 72666 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/jquery/3.6.4/jquery.slim.min.js
 89795 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/jquery/3.6.4/jquery.min.js
239159 Tue Mar 14 09:28:10 CDT 2023 META-INF/resources/webjars/jquery/3.6.4/jquery.slim.js
     0 Tue Mar 14 09:28:12 CDT 2023 META-INF/maven/org.webjars/
     0 Tue Mar 14 09:28:12 CDT 2023 META-INF/maven/org.webjars/jquery/
  7385 Tue Mar 14 09:28:08 CDT 2023 META-INF/maven/org.webjars/jquery/pom.xml
   102 Tue Mar 14 09:28:12 CDT 2023 META-INF/maven/org.webjars/jquery/pom.properties
$ jar -tvf popper.js-1.16.0.jar | grep webjars
     0 Thu Jan 30 08:46:30 CST 2020 META-INF/resources/webjars/
     0 Thu Jan 30 08:46:30 CST 2020 META-INF/resources/webjars/popper.js/
     0 Thu Jan 30 08:46:30 CST 2020 META-INF/resources/webjars/popper.js/1.16.0/
     0 Thu Jan 30 08:46:30 CST 2020 META-INF/resources/webjars/popper.js/1.16.0/esm/
     0 Thu Jan 30 08:46:30 CST 2020 META-INF/resources/webjars/popper.js/1.16.0/umd/
 84893 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/popper.js
 88514 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/esm/popper.js
 61842 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/esm/popper-utils.js.map
140865 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/esm/popper.js.map
 35590 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/esm/popper-utils.js
125443 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/esm/popper.min.js.map
 10672 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/esm/popper-utils.min.js
 54061 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/esm/popper-utils.min.js.map
 21228 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/esm/popper.min.js
 61577 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/popper-utils.js.map
140192 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/popper.js.map
 88768 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/umd/popper.js
 61884 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/umd/popper-utils.js.map
140875 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/umd/popper.js.map
 36692 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/umd/popper-utils.js
  3114 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/umd/popper.js.flow
123890 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/umd/popper.min.js.map
 10831 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/umd/popper-utils.min.js
 53858 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/umd/popper-utils.min.js.map
 21257 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/umd/popper.min.js
 33918 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/popper-utils.js
125243 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/popper.min.js.map
 10219 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/popper-utils.min.js
 53855 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/popper-utils.min.js.map
 19927 Wed Oct 16 04:34:44 CDT 2019 META-INF/resources/webjars/popper.js/1.16.0/popper.min.js
     0 Thu Jan 30 08:46:30 CST 2020 META-INF/maven/org.webjars/
     0 Thu Jan 30 08:46:30 CST 2020 META-INF/maven/org.webjars/popper.js/
  4460 Thu Jan 30 08:46:20 CST 2020 META-INF/maven/org.webjars/popper.js/pom.xml
   106 Thu Jan 30 08:46:30 CST 2020 META-INF/maven/org.webjars/popper.js/pom.properties
$ jar -tvf bootstrap-4.6.2.jar | grep webjars
     0 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/
     0 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/
     0 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/
     0 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/
     0 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/
     0 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/vendor/
     0 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/
     0 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/
     0 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/
 25944 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.js.gz
308871 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.bundle.min.js.map
230599 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.bundle.js
137714 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.js
 22138 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.bundle.min.js.gz
 15311 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.min.js.gz
 62563 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.min.js
426918 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.bundle.js.map
271784 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.js.map
 83376 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.bundle.min.js
 49088 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.bundle.js.gz
185257 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/js/bootstrap.min.js.map
   182 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/webjars-requirejs.js.gz
  2344 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_nav.scss
  1745 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_grid.scss
  3112 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_custom-forms.scss.gz
  7067 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/vendor/_rfs.scss
  2137 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/vendor/_rfs.scss.gz
  2518 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_tooltip.scss
  2053 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_modal.scss.gz
  7529 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_navbar.scss
  1504 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_carousel.scss.gz
  3870 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_list-group.scss
   462 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_progress.scss.gz
   711 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_type.scss.gz
  2685 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_buttons.scss
   678 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_grid.scss.gz
   735 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_tooltip.scss.gz
 15700 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_custom-forms.scss
  4436 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_dropdown.scss
   169 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_utilities.scss.gz
   459 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_toasts.scss.gz
   301 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_root.scss.gz
   363 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/bootstrap.scss.gz
   581 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_pagination.scss.gz
   918 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/bootstrap.scss
 11539 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_reboot.scss
  1326 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_breadcrumb.scss
   230 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_position.scss.gz
   498 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_sizing.scss
   737 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_text.scss.gz
   250 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_sizing.scss.gz
   853 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_embed.scss
   120 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_interactions.scss.gz
   126 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_visibility.scss.gz
   118 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_overflow.scss.gz
   431 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_stretched-link.scss
   115 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_screenreaders.scss
   211 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_background.scss.gz
  1771 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_borders.scss
   193 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_float.scss.gz
   409 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_background.scss
   484 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_position.scss
   174 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_visibility.scss
   509 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_spacing.scss.gz
   376 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_float.scss
   348 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_embed.scss.gz
   165 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_align.scss.gz
  2769 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_flex.scss
    37 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_clearfix.scss
   420 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_align.scss
  2108 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_spacing.scss
  2106 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_text.scss
   259 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_display.scss.gz
   124 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_shadows.scss.gz
    90 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_screenreaders.scss.gz
   519 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_display.scss
   133 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_overflow.scss
   577 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_flex.scss.gz
   388 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_borders.scss.gz
   287 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_stretched-link.scss.gz
   142 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_interactions.scss
    51 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_clearfix.scss.gz
   249 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/utilities/_shadows.scss
   465 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_code.scss.gz
   253 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/bootstrap-reboot.scss.gz
   409 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/bootstrap-reboot.scss
  1171 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_progress.scss
  6310 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_modal.scss
 48615 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_variables.scss
  1064 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_popover.scss.gz
  1164 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_alert.scss
   940 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_close.scss
  1387 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_button-group.scss.gz
   614 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_images.scss.gz
  3626 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_button-group.scss
  4843 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_carousel.scss
  1032 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_print.scss.gz
   335 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/bootstrap-grid.scss.gz
   836 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_nav.scss.gz
   182 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_transitions.scss.gz
  9246 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_forms.scss
  9605 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_variables.scss.gz
   536 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_utilities.scss
   371 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_mixins.scss.gz
  1497 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_dropdown.scss.gz
  4361 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_reboot.scss.gz
   458 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_spinners.scss.gz
  2222 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_type.scss
   363 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_transitions.scss
  5940 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_card.scss
   598 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/bootstrap-grid.scss
   406 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_jumbotron.scss
  2066 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_navbar.scss.gz
   572 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_root.scss
  1167 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_tables.scss.gz
  1121 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_badge.scss
   975 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_buttons.scss.gz
  1835 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_functions.scss.gz
  1158 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_images.scss
    83 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_media.scss
   377 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_table-row.scss.gz
  2086 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_grid.scss
   409 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_hover.scss.gz
   326 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_text-hide.scss
   604 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_image.scss.gz
   433 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_list-group.scss
  3525 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_buttons.scss
   168 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_text-truncate.scss
   865 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_grid.scss.gz
   250 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_nav-divider.scss.gz
   171 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_resize.scss.gz
  1155 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_image.scss
   154 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_visibility.scss.gz
   317 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_background-variant.scss.gz
   206 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_pagination.scss.gz
   613 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_deprecate.scss
   278 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_box-shadow.scss.gz
   391 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_border-radius.scss.gz
   369 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_nav-divider.scss
   242 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_alert.scss
  2089 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_grid-framework.scss
   269 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_text-emphasis.scss.gz
   827 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_screen-reader.scss
   175 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_float.scss.gz
   323 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_deprecate.scss.gz
   361 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_caret.scss.gz
   729 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_grid-framework.scss.gz
  5815 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_forms.scss
   260 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_reset-text.scss.gz
   239 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_text-hide.scss.gz
   189 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_visibility.scss
   532 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_box-shadow.scss
   681 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_transition.scss
   148 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_size.scss
   392 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_float.scss
  1189 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_breakpoints.scss.gz
  1422 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_caret.scss
  2050 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_gradients.scss
    93 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_clearfix.scss
  1828 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_border-radius.scss
   320 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_badge.scss
   848 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_buttons.scss.gz
   170 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_lists.scss
   695 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_background-variant.scss
   794 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_table-row.scss
   305 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_transition.scss.gz
   199 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_badge.scss.gz
   202 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_resize.scss
  4482 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_breakpoints.scss
   481 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_reset-text.scss
   146 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_lists.scss.gz
   527 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_gradients.scss.gz
   146 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_text-truncate.scss.gz
   474 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_text-emphasis.scss
   757 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_hover.scss
    95 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_clearfix.scss.gz
   134 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_size.scss.gz
   462 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_pagination.scss
   497 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_screen-reader.scss.gz
   205 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_list-group.scss.gz
   161 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_alert.scss.gz
  1600 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/mixins/_forms.scss.gz
  1012 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_code.scss
   546 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_badge.scss.gz
  1050 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_mixins.scss
  1758 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_input-group.scss.gz
  1625 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_card.scss.gz
  6521 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_input-group.scss
   195 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_jumbotron.scss.gz
    87 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_media.scss.gz
  3544 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_tables.scss
  5391 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_functions.scss
   585 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_breadcrumb.scss.gz
  1823 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_pagination.scss
  4720 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_popover.scss
  2838 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_print.scss
  1132 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_toasts.scss
  1287 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_spinners.scss
   499 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_close.scss.gz
  1270 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_list-group.scss.gz
   530 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_alert.scss.gz
  3039 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/scss/_forms.scss.gz
   284 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/webjars-requirejs.js
 50636 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid.min-jsf.css
115091 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid.min.css.map
  3922 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot.min.css
 33156 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot.min.css.map
654593 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap.min.css.map
  6185 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid.min.css.gz
 24181 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap.min-jsf.css.gz
 50636 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid.min.css
  6185 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid.min-jsf.css.gz
  4784 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot.css
  4784 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot-jsf.css
 67472 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid.css
  1701 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot.css.gz
200387 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap.css
162264 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap.min.css
  1593 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot.min-jsf.css.gz
  1593 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot.min.css.gz
  7107 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid.css.gz
  7107 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid-jsf.css.gz
163856 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid.css.map
 78154 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot.css.map
  3922 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot.min-jsf.css
162264 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap.min-jsf.css
  1701 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-reboot-jsf.css.gz
 67472 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-grid-jsf.css
 26430 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-jsf.css.gz
515619 Tue Jul 19 09:13:44 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap.css.map
200387 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap-jsf.css
 26430 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap.css.gz
 24181 Tue Aug 30 15:17:24 CDT 2022 META-INF/resources/webjars/bootstrap/4.6.2/css/bootstrap.min.css.gz
     0 Tue Aug 30 15:17:28 CDT 2022 META-INF/maven/org.webjars/
     0 Tue Aug 30 15:17:28 CDT 2022 META-INF/maven/org.webjars/bootstrap/
  8041 Tue Aug 30 15:17:22 CDT 2022 META-INF/maven/org.webjars/bootstrap/pom.xml
   105 Tue Aug 30 15:17:24 CDT 2022 META-INF/maven/org.webjars/bootstrap/pom.properties

In these examples, none of those belong in a Java Classloader.
Those are all valid resource bases though.

@kshep92
Copy link
Author

kshep92 commented Aug 2, 2024

Hi @joakime I'm not entirely sure what you are trying to illustrate. Are you saying that the fix that @gregw implemented or what I'm trying to achieve isn't practical?

@joakime
Copy link
Contributor

joakime commented Aug 2, 2024

@kshep92 the PR by @gregw makes the Resource lookup use an internal CombinedResource instead of first found.
It's a small improvement to use the features elsewhere in Jetty better.

The META-INF/resources trees (in jars) are part of the Servlet spec, and handled by Jetty in the MetaInfConfiguration class as part of WebAppContext featureset.

If you are using embedded Jetty and using something other than WebAppContext, such as a ServletContextHandler then you'll be responsible for creating the CombinedResource you give to the ServletContextHandler.setBaseResource(Resource).

You can find an example of that here -> https://github.com/jetty/jetty-examples/blob/12.0.x/embedded/ee10-metainf-resources/src/main/java/examples/MetaInfResourceDemo.java

@kshep92
Copy link
Author

kshep92 commented Aug 2, 2024

@joakime Ok that clears it up. Thanks for the example as well.

gregw added a commit that referenced this issue Aug 5, 2024
Fix #12104 by returning a CombinedResource for a ClassLoader resource that has multiple directory matches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants