feat(gateway-servlet) Use path parser for Servlet version.
MODIFY
gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/GatewayServlet.java
gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/GatewayServlet.java
@@ -204,7 +204,7 @@ public abstract class GatewayServlet extends HttpServlet {
* @throws IOException
*/
protected ApiRequest readRequest(HttpServletRequest request) throws Exception {
- ApiRequestPathInfo pathInfo = parseApiRequestPath(request);
+ ApiRequestPathInfo pathInfo = getEngine().getApiRequestPathParser().parseEndpoint(request.getPathInfo(), wrapMultiMap(request));//parseApiRequestPath(request);
if (pathInfo.orgId == null) {
throw new Exception(Messages.i18n.format("GatewayServlet.InvalidApiEndpoint")); //$NON-NLS-1$
}
@@ -227,6 +227,17 @@ public abstract class GatewayServlet extends HttpServlet {
return srequest;
}
+ private HeaderMap wrapMultiMap(HttpServletRequest request) {
+ return new HeaderMap() {
+ private static final long serialVersionUID = -1406124274678587935L;
+
+ @Override()
+ public String get(String key) {
+ return request.getHeader(key);
+ }
+ };
+ }
+
/**
* Gets the API Key from the request. The API key can be passed either via
* a custom http request header called X-API-Key or else by a query parameter
@@ -308,7 +319,7 @@ public abstract class GatewayServlet extends HttpServlet {
resp.getOutputStream().flush();
} catch (IOException e) {
e.printStackTrace();
- };
+ }
}
/**
@@ -351,7 +362,7 @@ public abstract class GatewayServlet extends HttpServlet {
resp.getOutputStream().flush();
} catch (IOException e) {
e.printStackTrace();
- };
+ }
}
/**

feat(gateway-servlet) Use path parser for Servlet version.