Class DefaultRoutingHelper
java.lang.Object
com.ibm.wsspi.rest.handler.helper.DefaultRoutingHelper
This helper service routes/bridges an incoming request to and from a RESTHandler that resides in another Collective member.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Encapsulates legacy constants for JMX connector clients v1, v2 and v3.static class
This inner class encapsulates the routing context. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 piecesgetLegacyRoutingContext
(RESTRequest request) This helper method looks for the routing keys in the HTTP headersstatic String
getQueryParameterValue
(RESTRequest request, String name) static String[]
getQueryParameterValues
(RESTRequest request, String name) 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 String
URLDecoder
(String name)
-
Constructor Details
-
DefaultRoutingHelper
public DefaultRoutingHelper()
-
-
Method Details
-
routeRequest
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
Quick check for legacy routing context (used from JMX connector) -
containsRoutingContext
Quick check for multiple routing context, without actually fetching all pieces -
getQueryParameterValue
-
getQueryParameterValues
-
getLegacyRoutingContext
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
-
getRoutingContext
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.
-