You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
However, I did only get either of them working. By switching the order, the other got working. It was always the latter which behaved as expected.
After following the registration process to the ServletEnvironment, one can see that the bundle is registered as a servlet with the default asset name which it is assigned if no other asset name had been specified. Having been assigned the same asset name, the latter servlet overrides a previously registered servlet with the same name.
The simple solution is to specify an explicit and unique assets name for each assets bundle.
bootstrap.addBundle(new ConfiguredAssetsBundle("/images", "/images", "index.html", "Image assets"));
bootstrap.addBundle(new ConfiguredAssetsBundle("/css", "/css", "style.css", "Style assets"));
Nevertheless, for convenience I suggest to change the default assets name to something unique for each bundle, e.g. by incorporating the resource path and/or the uri path. I can think of only very few scenarios where someone would like to override his own assets configuration.
As I didn't know that the asset name actually had a meaning, I found this worth mentioning, maybe someone will stumble open the same problem one day.
The text was updated successfully, but these errors were encountered:
Additionally, if you do override the servlet, the dropwizard log at startup should emit a warning from this (probably varies depending on the version of dropwizard, this exists in 0.8.1) :
LOGGER.warn("Overriding the existing {} registered with the name: {}", type, name);
If there is anything else I can do for you, feel free to file an issue in the maintained repository (i.e. the dropwizard-bundles version).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In my application I had defined two assets bundles like I had it with one assets bundle several times before.
bootstrap.addBundle(new ConfiguredAssetsBundle("/images", "/images")); bootstrap.addBundle(new ConfiguredAssetsBundle("/css", "/css"));
However, I did only get either of them working. By switching the order, the other got working. It was always the latter which behaved as expected.
After following the registration process to the ServletEnvironment, one can see that the bundle is registered as a servlet with the default asset name which it is assigned if no other asset name had been specified. Having been assigned the same asset name, the latter servlet overrides a previously registered servlet with the same name.
The simple solution is to specify an explicit and unique assets name for each assets bundle.
bootstrap.addBundle(new ConfiguredAssetsBundle("/images", "/images", "index.html", "Image assets"));
bootstrap.addBundle(new ConfiguredAssetsBundle("/css", "/css", "style.css", "Style assets"));
Nevertheless, for convenience I suggest to change the default assets name to something unique for each bundle, e.g. by incorporating the resource path and/or the uri path. I can think of only very few scenarios where someone would like to override his own assets configuration.
As I didn't know that the asset name actually had a meaning, I found this worth mentioning, maybe someone will stumble open the same problem one day.
The text was updated successfully, but these errors were encountered: