Package com.linkedin.r2.message.rest

Examples of com.linkedin.r2.message.rest.RestRequestBuilder


      throws URISyntaxException, ExecutionException, InterruptedException, RemoteInvocationException
  {
    Long newId = createNewGreetingOnTheServer(builders);

    RestRequest request =
        new RestRequestBuilder(
            new URI(URI_PREFIX + "greetingsPromise/" + newId + "/__debug/parseqtrace/tracevis"))
            .setMethod("PUT")
            .setEntity(createNewGreetingBytes(newId))
            .build();
View Full Code Here


  @Test
  public void testParseqTraceDebugPostRequestHandlerTracevis()
      throws URISyntaxException, ExecutionException, InterruptedException
  {
    RestRequest request =
        new RestRequestBuilder(
            new URI(URI_PREFIX + "greetingsPromise/__debug/parseqtrace/tracevis"))
            .setMethod("POST")
            .setEntity(createNewGreetingBytes(444L))
            .build();
View Full Code Here

      throws URISyntaxException, ExecutionException, InterruptedException, RemoteInvocationException
  {
    Long newId = createNewGreetingOnTheServer(builders);

    RestRequest request =
        new RestRequestBuilder(
            new URI(URI_PREFIX + "greetingsPromise/" + newId + "/__debug/parseqtrace/tracevis"))
            .setMethod("DELETE")
            .setEntity(createNewGreetingBytes(newId))
            .build();
View Full Code Here

  @Test
  public void testParseqTraceDebugRequestHandlerRaw()
      throws URISyntaxException, ExecutionException, InterruptedException
  {
    RestRequest request =
        new RestRequestBuilder(
            new URI(URI_PREFIX + "greetingsPromise/1/__debug/parseqtrace/raw"))
              .setMethod("GET")
              .build();

    sendRequestAndVerifyParseqTraceRaw(request);
View Full Code Here

      throws URISyntaxException, ExecutionException, InterruptedException, RemoteInvocationException
  {
    Long newId = createNewGreetingOnTheServer(builders);

    RestRequest request =
        new RestRequestBuilder(
            new URI(URI_PREFIX + "greetingsPromise/" + newId + "/__debug/parseqtrace/raw"))
            .setMethod("PUT")
            .setEntity(createNewGreetingBytes(newId))
            .build();
View Full Code Here

  @Test
  public void testParseqTraceDebugPostRequestHandlerRaw()
      throws URISyntaxException, ExecutionException, InterruptedException
  {
    RestRequest request =
        new RestRequestBuilder(
            new URI(URI_PREFIX + "greetingsPromise/__debug/parseqtrace/raw"))
            .setMethod("POST")
            .setEntity(createNewGreetingBytes(444L))
            .build();
View Full Code Here

      throws URISyntaxException, ExecutionException, InterruptedException, RemoteInvocationException
  {
    Long newId = createNewGreetingOnTheServer(builders);

    RestRequest request =
        new RestRequestBuilder(
            new URI(URI_PREFIX + "greetingsPromise/" + newId + "/__debug/parseqtrace/raw"))
            .setMethod("DELETE")
            .setEntity(createNewGreetingBytes(newId))
            .build();
View Full Code Here

      sb.append(query);
    }

    URI uri = new URI(sb.toString());

    RestRequestBuilder rb = new RestRequestBuilder(uri);
    rb.setMethod(req.getMethod());

    for (Enumeration<String> headerNames = req.getHeaderNames(); headerNames.hasMoreElements();)
    {
      // TODO multi-valued headers
      String headerName = headerNames.nextElement();
      rb.setHeader(headerName, req.getHeader(headerName));
    }
    int length = req.getContentLength();
    if (length >= 0)
    {
      InputStream in = req.getInputStream();
      byte[] buf = new byte[length];
      int offset = 0;
      for (int r; offset < length && (r = in.read(buf, offset, length - offset)) != -1; offset += r)
      {
      }

      rb.setEntity(buf);
    }
    return QueryTunnelUtil.decode(rb.build());
  }
View Full Code Here

    }

    final RestRequest newRequest;
    try
    {
      newRequest= QueryTunnelUtil.encode(new RestRequestBuilder(request)
                                             .overwriteHeaders(WireAttributeHelper.toWireAttributes(wireAttrs))
                                             .build(),
                                         _queryPostThreshold);
    }
    catch (IOException e)
View Full Code Here

    protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg)
            throws Exception
    {
      HttpRequest nettyRequest = (HttpRequest) msg;
      URI uri = new URI(nettyRequest.getUri());
      RestRequestBuilder builder = new RestRequestBuilder(uri);
      builder.setMethod(nettyRequest.getMethod().getName());
      for (Map.Entry<String, String> e : nettyRequest.getHeaders())
      {
        builder.unsafeAddHeaderValue(e.getKey(), e.getValue());
      }
      ChannelBuffer buf = nettyRequest.getContent();
      if (buf != null)
      {
        if (buf.hasArray())
        {
          // TODO make a copy?
          builder.setEntity(buf.array());
        }
      }

      return builder.build();
    }
View Full Code Here

TOP

Related Classes of com.linkedin.r2.message.rest.RestRequestBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.