8000 Tomcat Configuration · rife2/rife2 Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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.

Web Application with Jetty

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.

Web Application with Tomcat

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

Clone this wiki locally
0