12.3. Configuring the Gateway

download PDF

Configuring with the Management Console

To configure the gateway using the Management Console UI, navigate to the Profiles page then click on the Configuration tab, then select either the Fabric8 HTTP Gateway or the Fabric8 MQ Gateway to configure its settings.

HTTP mapping rules

When using the HTTP gateway, it is a common requirement to map different versions of Web applications or Web services to different URI paths on the gateway. You can perform very flexible mappings using URI templates.
The default behavior is to expose all Web applications and Web services at the context path they are running in the target server. For example, if you deploy the example-quickstarts-rest profile, that uses a URI like /cxf/crm/customerservice/customers/123 on whatever host and port it is deployed on. Hence, by default, it is visible on the gateway at http://localhost:9000/cxf/crm/customerservice/customers/123. For this example, the URI template is:
Which means take the context path (in the above case, /cxf/crm) and append /, giving /cxf/crm/. Any request within that path is then passed to an instance of the CXF crm service.

Selecting part of the ZooKeeper registry

The mapping rules for the MQ gateway and the HTTP gateway are tied to particular regions of the ZooKeeper registry. If you specify a ZooKeeper path for a mapping rule, any services registered under that path become associated with that rule.
For example, in the case of messaging, you could associate a messaging gateway with all message brokers worldwide. Alternatively, you could provide continent-specific, country-specific or region-specific gateways, just by specifying different ZooKeeper paths for each gateway configuration. For regional messaging clusters, use different ZooKeeper folders for geographically distinct broker clusters.
With HTTP then REST APIs, SOAP Web Services, servlets and web applications all live in different parts of the ZooKeeper registry. From the Management Console UI, you can browse the contents of the registry in the Runtime | Registry section of the console (in the Fabric view).
Here are the common ZooKeeper paths:
ZooKeeper Path Description
/fabric/registry/clusters/apis/rest REST based web services
/fabric/registry/clusters/apis/ws SOAP based web services
/fabric/registry/clusters/servlets Servlets (registered usually individually via the OSGI APIs)
/fabric/registry/clusters/webapps Web Applications (i.e. WARs)

Segregating URI paths

You might want to segregate servlets, Web services, or Web applications into different URI spaces.
For example, if you want all Web services to be available under /api/ and Web applications to be available under /app/, update the URI templates as follows:
For the Web services mapping rule:
ZooKeeperPath: /fabric/registry/clusters/apis
URI template: /api{contextPath}/
For the Web applications mapping rule:
ZooKeeperPath: /fabric/registry/clusters/webapps
URI template: /app{contextPath}/
If you want to split RESTful APIs and SOAP web services into different URI paths, replace the preceding mapping rule with the following rules:
ZooKeeperPath: /fabric/registry/clusters/apis/rest
URI template: /rest{contextPath}/

ZooKeeperPath: /fabric/registry/clusters/apis/ws
URI template: /ws{contextPath}/
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.