I'm trying to add webapp folder with static HTML pages to JAXRSArchive with Wildfly Swarm. But unfortunately it was not successful. How can I do that?
Wildfly Swarm JAXRSArchive add webapp directory
703 Views Asked by Nikita At
3
There are 3 best solutions below
4
On
Can you elaborate on why you need a custom main()?
The preferred option is to not use a custom main(), or if you must have a custom main() to not customize the deployment.
You can just call Swarm.deploy() and it will create a default deployment, which if your project is of type war, will work fine
0
On
This question is outdated. But I post this solution for those who run into the same issue.
The problem might happen if you're using JAX-RS without specifying @ApplicationPath.
By default JAX-RS listens to the root / of your app and overrides standard mapping.
In this case you have to add configuration like this:
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/api")
public class JaxRSConfiguration extends Application {
}
This will prefix all your JAX-RS endpoints with /api and let you work with static content.
Copy all your static files in
src/main/webappand in you main method add the callstaticContenetas follows