Tomcat Configuration
Erik C. Thauvin edited this page Nov 6, 2023
·
3 revisions
RIFE2 is using Jetty as its default embedded server, switching to Tomcat is pretty easy.
A typical web application configuration might look something like:
package hello;
import rife.engine.*;
public class AppSite extends Site {
public void setup() {
get("/hello", c -> c.print("Hello World"));
}
public static void main(String[] args) {
new Server().start(new AppSite());
}
}
The main method would start Jetty by default.
To switch to Tomcat, change the main method as follows:
public static void main(String[] args) {
new TomcatServer()
.addWebapp("src/main/webapp")
.start(new AppSite());
}
Tomcat will now start by default.
Next learn more about Hosting