code: private HttpUriRequest proxyRequest(HttpServletRequest request) throws ServletException,
              IOException {
          String newUri = serviceUriForRequest(request);
  
          BasicHttpEntityEnclosingRequest httpRequest
                  = new BasicHttpEntityEnclosingRequest(request.getMethod(), newUri);
          HttpEntity entity = new InputStreamEntity(request.getInputStream(),
                  request.getContentLength());
          httpRequest.setEntity(entity);
  
          try {
              // Sadly have to do this to set the URI; it is not derived from the original httpRequest
              HttpRequestWrapper wrappedRequest = HttpRequestWrapper.wrap(httpRequest);
              wrappedRequest.setURI(new URI(newUri));
  
              // Somehow, content type header does not come in the original request either
              wrappedRequest.setHeader("Content-Type", "application/json");
  
              return wrappedRequest;
          } catch (URISyntaxException e) {
              LOGGER.error("Syntax exception in service URI, " + newUri, e);
              throw new LightblueServletException("Syntax exception in service URI, " + newUri, e);
          }
      }
docs: For the given servlet request, return a new request object (for use with
  Apache HttpClient), that may be executed in place of the original request
  to make the real service call.
  
  @throws javax.servlet.ServletException