Module ringo/httpserver/builder
A module for configuring an http(s) server
Class HttpServerBuilder
Instance Methods
- addEventSource(path, onConnect, initParams)
- addFilter(path, filter, initParams)
- addWebSocket(path, onConnect, onCreate, initParams)
- configure(xmlPath)
- enableConnectionStatistics()
- enableSessions(options)
- http(options)
- https(options)
- serveApplication(mountpoint, app, options)
- serveStatic(mountpoint, directory, options)
- start()
HttpServerBuilder.prototype. addEventSource (path, onConnect, initParams)
Adds an EventSource connnector to the current application context, which must have been configured before.
Parameters
String | path | The path of the EventSource connector |
Function | onConnect | An optional callback function invoked with the EventSource instance and the request object as arguments |
Object | initParams | An object containing servlet init parameters (see org.eclipse.jetty.servlets.EventSourceServlet) |
Returns
HttpServerBuilder |
HttpServerBuilder.prototype. addFilter (path, filter, initParams)
Adds a servlet filter to the chain of the current application context, which must have been configured before.
Parameters
String | path | The path spec of this filter |
jakarta.servlet.Filter | filter | The filter to add |
Object | initParams | An object containing init parameters to pass to the org.eclipse.jetty.servlet.FilterHolder |
Returns
HttpServerBuilder |
HttpServerBuilder.prototype. addWebSocket (path, onConnect, onCreate, initParams)
Adds a websocket connector to the current application context., which must have been configured before.
Parameters
String | path | The path of the websocket connector |
Function | onConnect | An optional callback function invoked with the websocket and the session as arguments |
Function | onCreate | An optional callback function invoked with the request and response objects as arguments. If this callback returns a value other than true, the connection is aborted. |
Object | initParams | An object containing servlet init parameters (see org.eclipse.jetty.websocket.servlet.WebSocketServlet |
Returns
HttpServerBuilder |
HttpServerBuilder.prototype. configure (xmlPath)
Configures the HttpServer with the jetty.xml configuration file
Parameters
String | xmlPath | The path to the jetty.xml configuration file |
Returns
HttpServerBuilder |
HttpServerBuilder.prototype. enableConnectionStatistics ()
Enables statistics for all connectors
Returns
HttpServerBuilder |
HttpServerBuilder.prototype. enableSessions (options)
Enables sessions with the specified options
Parameters
Object | options | An object containing the following options:
|
Returns
HttpServerBuilder |
HttpServerBuilder.prototype. http (options)
Configures a HTTP listener with the specified options
Parameters
Object | options | An object containing the following options:
|
Returns
HttpServerBuilder |
HttpServerBuilder.prototype. https (options)
Configures a HTTPS listener with the specified options
Parameters
Object | options | An object containing the following options:
|
Returns
HttpServerBuilder |
HttpServerBuilder.prototype. serveApplication (mountpoint, app, options)
Configures the http server to serve an application at the specified mountpoint
Parameters
String | mountpoint | The mountpoint to server the application at |
String|Function | app | The application to server. Can be defined either as string specifying the application module to load, or as a function. |
Object | options | An object containing the following options:
|
Returns
HttpServerBuilder |
HttpServerBuilder.prototype. serveStatic (mountpoint, directory, options)
Configures the http server to serve static files at the specified mountpoint
Parameters
String | mountpoint | The mountpoint to server the static files at |
String | directory | The directory containing the static files |
Object | options | An object containing the following options:
|
Returns
HttpServerBuilder |