+

Search Tips   |   Advanced Search

Exposing REST endpoints within the Liberty profile

We can use the REST Handler framework in the Liberty SPI to expose new REST endpoints.

The REST Handler framework is for Liberty extenders to use when exposing new REST endpoints. We can expose REST endpoints in an OSGi component, or a set of components.

  1. Create an OSGi component that registers itself as listening to a sub-root that appends to /ibm/api and implements the com.ibm.wsspi.rest.handler.RESTHandler interface; for example:
    @Component(service = { RESTHandler.class },        configurationPolicy = ConfigurationPolicy.IGNORE,        immediate = true,        property = { "service.vendor=IBM",                     RESTHandler.PROPERTY_REST_HANDLER_ROOT + "=/myTest/abc" })
    public class RESTHANDLERTest1 implements RESTHandler {
    ...

  2. Package the component into an OSGi bundle that is part of the extended user feature.

  3. Ensure that the feature includes the OSGi subsystem content:

      com.ibm.websphere.appserver.restHandler-1.0; type="osgi.subsystem.feature"

  4. Configure SSL certificates in server.xml.

  5. Configure a user or group to the administrator role in server.xml.

  6. Start the feature.

    Start the feature starts the REST Handler framework and registers the OSGi component. After the feature starts, we can make calls to https://<host>:<https_port>/ibm/api/myTest/abc.


Parent topic: Liberty SPI utilities

Related information:

Liberty SPI -- WebSphere REST Handler SPI