com.ibm.wsspi.rest.handler.helper

Class DefaultRoutingHelper

  • java.lang.Object
    • com.ibm.wsspi.rest.handler.helper.DefaultRoutingHelper


  • public class DefaultRoutingHelper
    extends java.lang.Object
    This helper service routes/bridges an incoming request to and from a RESTHandler that resides in another Collective member.
    • Constructor Detail

      • DefaultRoutingHelper

        public DefaultRoutingHelper()
    • Method Detail

      • routeRequest

        public void routeRequest(RESTRequest request,
                                 RESTResponse response)
                          throws java.io.IOException
        The target RESTHandler did not want to provide custom routing, so route the request to it.
        Throws:
        java.io.IOException
      • routeRequest

        public void routeRequest(RESTRequest request,
                                 RESTResponse response,
                                 boolean legacyURI)
                          throws java.io.IOException
        The target RESTHandler did not want to provide custom routing, so route the request to it.
        Parameters:
        request -
        response -
        legacyURI - whether or not the request is using the legacy /router URI
        Throws:
        java.io.IOException
      • containsLegacyRoutingContext

        public static boolean containsLegacyRoutingContext(RESTRequest request)
        Quick check for legacy routing context (used from JMX connector)
      • containsRoutingContext

        public static boolean containsRoutingContext(RESTRequest request)
        Quick check for multiple routing context, without actually fetching all pieces
      • getQueryParameterValue

        public static java.lang.String getQueryParameterValue(RESTRequest request,
                                                              java.lang.String name)
      • getQueryParameterValues

        public static java.lang.String[] getQueryParameterValues(RESTRequest request,
                                                                 java.lang.String name)
      • getLegacyRoutingContext

        public static DefaultRoutingHelper.RoutingContext getLegacyRoutingContext(RESTRequest request)
        This helper method looks for the routing keys in the HTTP headers
        Parameters:
        httpServletRequest - of the current request
        Returns:
        a 3-sized String array containing hostName, userDir and serverName respectively, or null if no routing context was found.
      • URLDecoder

        public static java.lang.String URLDecoder(java.lang.String name)
      • getRoutingContext

        public static java.util.List<DefaultRoutingHelper.RoutingContext> getRoutingContext(RESTRequest request)
        This helper method looks for the routing keys in the HTTP headers first, and then falls-back into looking at the query string.
        Parameters:
        httpServletRequest - of the current request
        Returns:
        a list of routing contexts, or null if none found.