Dropwizard version 1.3.0-rc6
Most documentation regarding serving static content are for older versions, and even the updated docs in Dropwizard Manual aren't exactly working for me.
I want to serve a static html file. I have modified the structure/paths of where these assets are served from, but can't quite get the configuration right in my environment.
Static content is located under the following structure
src/main/
├── java
│ └── org
│ └── com
│ └── query
│
│ ├── rest
│ │ ├── api
│ │ ├── cli
│ │ ├── core
│ │ ├── db
│ │ ├── health
│ │ ├── resources
│ │ ├── tasks
│ │ └── views
│
├── resources
│ ├── META-INF
│ │ ├── bin-license-notice
│ │ │ └── licenses
│ │ └── services
│ └── rest
│ ├── ftl
│ └── mustache
└── webapp
├── WEB-INF
│ └── views
│ └── jsp
└── resources
└── core
├── css
└── js
multiFileUpload.html is inside src/main/webapp/resources/core dir, which is ultimately what I want to serve. However, this is different than dropwizard standards of src/main/resources/assets/.
I need the extended constructor to specify the individual AssetBundles as I plan on having multiple instances of AssetBundle. This is what I have inside my application initialize method.
@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
bootstrap.addBundle(new AssetsBundle("/webapp/resources/core/*", "/", null, "/MultiFileUpload.html"));
}
I have also set a urlPattern in the applications run method.
environment.jersey().setUrlPattern("/rest/*");
The root path in my config.yml is rootPath:/rest/*
I have an endpoint that the .html file should be served at. localhost:port/rest/upload/multiFile
I'm almost certain one of these paths is incorrect but I have tried to change them according to documentation examples, but haven't had any luck.
webappisn't part of any of your resource paths so DW can't see it. Try mounting it as an absolute path, if that works, it's a classpath issue - tddmonkeywebappis simply a sub-dir containing the static content. The file upload service itself has been registered in the environment configuration of my DW app. I'll see what providing the full absolute path does. @tddmonkey - DJ2