Creating custom REST request handlers

We can create custom REST request handlers to communicate with the REST post-processing system. A template is provided that we can adapt for our own purposes.


Procedure

  1. Create a new request handler that implements the RequestHandler call with RequestHandlerAnnotation defined.

      handleRequest(MessageContext, HandlersChain) method
      @RequestHandlerAnnotation(
      sequence="200"
      public class CustomRequestHandler implements RequestHandler {
          @Override
          public void handleRequest(MessageContext messageContext,
                            HandlersChain handlersChain) {
                             // Add our own logic here       
      
                            handlersChain.doChain(messageContext);
                            // Add our own logic here
          }
      }

    Where

      sequence
      Defines the registered order in which the request handler will be executed. Permitted values range from 0 to 2147483647. Default is 100. If two sequences are the same in a customized request handler, only the one loaded last will take effect.

  2. Restart the server and test your REST request handler.