public ServletRestRequest(HttpServletRequest servletRequest) throws IOException {
    this.servletRequest = servletRequest;
    this.method = Method.valueOf(servletRequest.getMethod());
    this.params = new HashMap<String, String>();

    if (servletRequest.getQueryString() != null) {
      RestUtils.decodeQueryString(servletRequest.getQueryString(), 0, params);
    }

    content = Streams.copyToByteArray(servletRequest.getInputStream());
  }
 public MemcachedRestRequest(
     Method method, String uri, byte[] uriBytes, int dataSize, boolean binary) {
   this.method = method;
   this.uri = uri;
   this.uriBytes = uriBytes;
   this.dataSize = dataSize;
   this.binary = binary;
   this.params = new HashMap<String, String>();
   int pathEndPos = uri.indexOf('?');
   if (pathEndPos < 0) {
     this.rawPath = uri;
   } else {
     this.rawPath = uri.substring(0, pathEndPos);
     RestUtils.decodeQueryString(uri, pathEndPos + 1, params);
   }
 }
예제 #3
0
    JaxRsRestRequest(HttpServletRequest servletRequest, String body) {
      this.body = body;
      this.servletRequest = servletRequest;
      params = Maps.newHashMap();

      // Remove the opal-ws part of the requested uri
      rawPath =
          servletRequest
              .getRequestURI()
              .replaceFirst(servletRequest.getContextPath(), "")
              .replaceFirst(servletRequest.getServletPath(), "")
              .replaceFirst("/es", "");

      // Reconstruct the uri
      String queryString = servletRequest.getQueryString();
      esUri = rawPath + (queryString != null ? '?' + queryString : "");

      RestUtils.decodeQueryString(queryString != null ? queryString : "", 0, params);
    }