code: protected ApiRequest readRequest(HttpServletRequest request) throws Exception {
          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$
          }
          QueryMap queryParams = parseApiRequestQueryParams(request.getQueryString());
  
          String apiKey = getApiKey(request, queryParams);
  
          ApiRequest srequest = GatewayThreadContext.getApiRequest();
          srequest.setApiKey(apiKey);
          srequest.setApiOrgId(pathInfo.orgId);
          srequest.setApiId(pathInfo.apiId);
          srequest.setApiVersion(pathInfo.apiVersion);
          srequest.setUrl(request.getRequestURL().toString());
          srequest.setDestination(pathInfo.resource);
          srequest.setQueryParams(queryParams);
          readHeaders(srequest, request);
          srequest.setRawRequest(request);
          srequest.setRemoteAddr(request.getRemoteAddr());
          srequest.setTransportSecure(request.isSecure());
          return srequest;
      }
docs: Reads a {@link ApiRequest} from information found in the inbound
  portion of the http request.
  @param request the undertow http server request
  @return a valid {@link ApiRequest}
  @throws IOException