Loading

HTTP Plugin

This plugin was designed to build custom HTTP API easily. For each API endpoint, you can build the answer from within WarpScript.

Installation

In a configuration file, usually etc/conf.d/80--plugins.conf, set:

// Activate the HTTP plugin
warp10.plugin.http = io.warp10.plugins.http.HTTPWarp10Plugin

Configuration

Your custom configurations can be stored in a new etc/conf.d/99-myWarp10.conf file. Your custom configurations will override all the predefined Warp 10 configurations.

// IP the HTTP plugin will listen on. Listen on every interfaces
http.host = 0.0.0.0
// Port the HTTP plugin will listen on
http.port = 10080
// TCP Backlog for the HTTP plugin listener
#http.tcp.backlog =
// Number of Jetty acceptors to use (defaults to 2)
http.acceptors = 2
// Number of Jetty selectors to use (defaults to 4)
http.selectors = 4
// Number of threads Jetty should use (defaults to 1 + acceptors + acceptors * selectors which is the strict minimum for one request)
// All selectors/acceptors (with and without SSL support, see http.ssl.selectors/http.ssl.acceptors) must be considered
// see this discussion to estimate your needs: https://www.eclipse.org/lists/jetty-users/msg05196.html
http.maxthreads = 200
// Timeout (in ms) when expecting a HTTP request (defaults to 30000 ms)
http.idle.timeout = 30000
// Directory where spec files are located
http.dir = ${standalone.home}/http/
// Period (in ms) at which to scan 'http.dir' (defaults to 60s)
http.period = 60000
// Size of the queue to use for the Jetty thread pool. By default no queue is used
http.queuesize = 8
// Set to false to disable support for gzipped responses
#http.gzip = false
// Set to true to convert header names to lower case in the request map
#http.lcheaders = true

The WarpScript files that describe each endpoint could be stored anywhere the user warp10 can access. For configuration simplicity, you create a "http" directory inside /opt/warp10, and specify http.dir = ${standalone.home}/http/ in the configuration.

Examples

See Hello World and more examples here: