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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DefaultRoutingHelper.LegacyJMX
Encapsulates legacy constants for JMX connector clients v1, v2 and v3.static class
DefaultRoutingHelper.RoutingContext
This inner class encapsulates the routing context.
-
Constructor Summary
Constructors Constructor Description DefaultRoutingHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
containsLegacyRoutingContext(RESTRequest request)
Quick check for legacy routing context (used from JMX connector)static boolean
containsRoutingContext(RESTRequest request)
Quick check for multiple routing context, without actually fetching all piecesstatic DefaultRoutingHelper.RoutingContext
getLegacyRoutingContext(RESTRequest request)
This helper method looks for the routing keys in the HTTP headersstatic java.lang.String
getQueryParameterValue(RESTRequest request, java.lang.String name)
static java.lang.String[]
getQueryParameterValues(RESTRequest request, java.lang.String name)
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.void
routeRequest(RESTRequest request, RESTResponse response)
The target RESTHandler did not want to provide custom routing, so route the request to it.void
routeRequest(RESTRequest request, RESTResponse response, boolean legacyURI)
The target RESTHandler did not want to provide custom routing, so route the request to it.static java.lang.String
URLDecoder(java.lang.String name)
-
-
-
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.
-
-