I used spark web framework to create a webapp, but I don't know how to deploy this webapp. I'm sorry if this is very basic, but I'm new to spark framework and I cannot find any document that guide me how to deploy a spark webapp.:
You will first need to create a regular Java project that can be built into a .war file (in Eclipse this would be a Dynamic Web Project)
The spark documentation at this link describes what needs to be added to your projects web.xml file. http://sparkjava.com/documentation.html#other-webserver
the param-value listed in the documentation within the filter needs to point to the class where you have defined your routes.
Additionally, all the code that was previously in main() needs to be moved to init().
@Override
public void init() {
get(new Route("/test") {
@Override
public Object handle(Request request, Response response) {
return "response goes here;
}
});
Also, in order for me to deploy it to JBoss, I had to only include the spark libraries and not the Jetty libraries. Once this was done, you should be able to build the war and deploy it to your server the same way you would any other Java project.