forked from linkedin/rest.li
-
Notifications
You must be signed in to change notification settings - Fork 0
Rest.li with Netty
Joe Betz edited this page Jul 26, 2013
·
7 revisions
Rest.li may be run in a variety of http frameworks. Out of the box, Rest.li supports both Netty and Servlet containers like Jetty.
This describes how to run Rest.li with Netty.
Rest.li includes a restli-netty-standalone artifact containing a single class: com.linkedin.restli.server.NettyStandaloneLauncher. This launcher class configures a Netty server to dispatch requests to all Rest.li resources that are both in the current classpath and in the list of package names the launcher is provided when it is created.
import com.linkedin.restli.server.NettyStandaloneLauncher;
...
NettyStandaloneLauncher launcher = new NettyStandaloneLauncher(
8080 /*port*/,
"com.example.fortunes" /* resource package(s) */
);
launcher.start();
// ... server is running. launcher.stop() can be called to stop it.
java -cp <classpath> com.linkedin.restli.server.NettyStandaloneLauncher 8080 com.example.fortunes
task startFortunesServer(type: JavaExec) {
main = 'com.linkedin.restli.server.NettyStandaloneLauncher'
args = ['-port', '8080', '-packages', 'com.example.fortune.impl']
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}