Class DefaultRoutingHelper

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

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

    • DefaultRoutingHelper

      public DefaultRoutingHelper()
  • Method Details

    • routeRequest

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

      public void routeRequest(RESTRequest request, RESTResponse response, boolean legacyURI) throws 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:
      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 String getQueryParameterValue(RESTRequest request, String name)
    • getQueryParameterValues

      public static String[] getQueryParameterValues(RESTRequest request, 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 String URLDecoder(String name)
    • getRoutingContext

      public static 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.