-
Notifications
You must be signed in to change notification settings - Fork 546
Rest.li with Netty
Karan Parikh edited this page Oct 16, 2013
·
8 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.
Thread pool sizes may also optionally be configured using the overloaded constructor.
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
}
Thread pool sizes may also optionally be configured by providing a number to the '-thread' and '-parseqthreads' args.
Quick Access:
- Tutorials
- Dynamic Discovery
- Request Response API
-
Rest.li User Guide
- Rest.li Server
- Resources
- Resource Types
- Resource Methods
- Rest.li Client
- Projections
- Filters
- Wire Protocol
- Data Schemas
- Data
- Unstructured Data
- Tools
- FAQ