Project

General

Profile

Configuration for version 1.2.0+

Basic configuration

Below is example configuration required by component:

--comp-name-3=http
--comp-class-3=tigase.http.HttpMessageReceiver

In default configuration component will try to start standalone Jetty HTTP Server on port 8080 and add start default modules including RestModule which will add context for REST API in /rest path . RestModule will also load all groovy scripts located in scripts/rest/xxx directories and will bind it to proper action for paths /rest/xxx/. (xxx - is just an example directory name, more than one directory can be used).

Important: Scripts which handle HTTP requests are available in repository of component under src/scripts/groovy/tigase/rest/

Properties

Here are additional properties from Tigase XMPP Server init.properties file supported by component:

  • <component_name>/http/ports[i] - set comma separated list of ports on which HTTP server will listen for connections (default to 8080)
  • <component_name>/http/xxx/socket=ssl - where xxx is numer of port which you want to listen for HTTPS connections
  • <component_name>/http/xxx/domain=example.com - where xxx is number of port which you want to listen for HTTPS connections (above setting required) and set domain name of SSL certificate from Tigase XMPP Server certificate store which should be used
  • <component_name>/http/server-class - sets name of class used to manage HTTP server Following class names may be used for server-class property:
    • tigase.http.jetty.JettyStandaloneHttpServer - starts standalone Jetty HTTP Server instance (require Tigase HTTP API - Jetty HTTP Server)
    • tigase.http.jetty.JettyOSGiHttpServer - uses Jetty HTTP Server instance available as OSGi service (may be used only in OSGi envoirment) (require Tigase HTTP API - Jetty HTTP Server)
    • tigase.http.java.JavaStandaloneHttpServer - uses HttpServer provided by Java JDK to start standalone HTTP server (may not work on JDK from every JDK provider)

Important: Property <component_name>/http/port is still supported as In version 1.1.0, however is now deprecated and may be removed in future version - use http/ports[i] instead.

Modules

Tigase HTTP API component provides functionalities as modules which may be enabled or disabled and configured separately.

Common settings for modules which can be passed in component properties in following format @component_name@/@module_id@/@module_setting@:

  • active[B] - values true/false to enable or disable module

  • context-path - path of http context under which module should be available

  • vhosts[s] - comma separated list of virtual hosts under which module should be available (if not configured, module will appear for every vhost)

Example of disabling DnsWebServiceModule for component HTTP API component configured for name @http@:

http/dns-webservice/active[B]=false

Available modules:

RestModule (rest)

Module provides support for REST API.

Available module properties:

  • rest-scripts-dir - path to directory containing scripts processing REST requests (default: scripts/rest)

  • api-keys[s] - comma separated list of strings which would be possible to use as keys to pass api-key parameter to request to authorize request execution (if nothing is passed then no request will be allowed, to allow any request this property needs to be set to open_access)

DnsWebServiceModule (dns-webservice)

Module provides support for resolution of DNS names using HTTP protocol - might be useful for web application which need to resolve DNS address to particular IP (ie. discover IP and port of WebSocket service to use to connect to XMPP server)

Configuration for version 1.1.0

Basic configuration

Below is example configuration required by component:

--comp-name-3=http
--comp-class-3=tigase.http.HttpMessageReceiver

In default configuration component will try to start standalone Jetty HTTP Server on port 8080 and add start default modules including RestModule which will add context for REST API in /rest path . RestModule will also load all groovy scripts located in scripts/rest/xxx directories and will bind it to proper action for paths /rest/xxx/@. (@xxx - is just an example directory name, more than one directory can be used).

Important: Scripts which handle HTTP requests are available in repository of component under src/scripts/groovy/tigase/rest/

Properties

Here are additional properties from Tigase XMPP Server init.properties file supported by component:

  • http/port - set port on which Jetty will listen for connections (default to 8080)

  • http/server-class - sets name of class used to manage HTTP server
    Following class names may be used for server-class property:

    • tigase.http.jetty.JettyStandaloneHttpServer - starts standalone Jetty HTTP Server instance (require Tigase HTTP API - Jetty HTTP Server)
    • tigase.http.jetty.JettyOSGiHttpServer - uses Jetty HTTP Server instance available as OSGi service (may be used only in OSGi envoirment) (require Tigase HTTP API - Jetty HTTP Server)
    • tigase.http.java.JavaStandaloneHttpServer - uses HttpServer provided by Java JDK to start standalone HTTP server (may not work on JDK from every JDK provider)

Modules

Tigase HTTP API component provides functionalities as modules which may be enabled or disabled and configured separately.

Common settings for modules which can be passed in component properties in following format component_name/module_id/module_setting:

  • active[B] - values true/false to enable or disable module

  • context-path - path of http context under which module should be available

  • vhosts[s] - comma separated list of virtual hosts under which module should be available (if not configured, module will appear for every vhost)

Example of disabling DnsWebServiceModule for component HTTP API component configured for name http:

http/dns-webservice/active[B]=false

Available modules:

RestModule (rest)

Module provides support for REST API.

Available module properties:

  • rest-scripts-dir - path to directory containing scripts processing REST requests (default: @scripts/rest@)

  • api-keys[s] - comma separated list of strings which would be possible to use as keys to pass api-key parameter to request to authorize request execution (if nothing is passed then no request will be allowed, to allow any request this property needs to be set to open_access)

DnsWebServiceModule (dns-webservice)

Module provides support for resolution of DNS names using HTTP protocol - might be useful for web application which need to resolve DNS address to particular IP (ie. discover IP and port of WebSocket service to use to connect to XMPP server)

Configuration for version 1.0.0

Basic configuration

Below is example configuration required by component:

--comp-name-3=rest
--comp-class-3=tigase.http.rest.RestMessageReceiver

In default configuration component will try to start Jetty HTTP Server on port 8080 and add context for REST API in /rest path. Component will also load all groovy scripts located in scripts/rest/xxx directories and will bind it to proper action for paths /rest/xxx/. (xxx - is just an example directory name, more than one directory can be used).

Important: Scripts which handle HTTP requests are available in repository of component under src/scripts/groovy/tigase/rest/

Properties

Here are additional properties from Tigase XMPP Server init.properties file supported by component:

  • port - set port on which Jetty will listen for connections (default to 8080)

  • context - set context path of REST API (default to /rest

  • rest-scripts-dir - set path to script directory used as handlers for HTTP requests (default to scripts/rest/)

Inside OSGi

If your are running Tigase XMPP Server inside OSGi you have two options for running Jetty:

as standalone HTTP server (default in OSGi)

In this case you need to configure Jetty using Jetty configuration XML files and properties.

as embadded HTTP sever

In this case component will start Jetty and configure it, but it is not default inside OSGi. You need to set property use-local-server to true in Tigase XMPP Server init.properties file. Example:

rest/use-local-server[B]=true

Included in documentation/