Package com.linkedin.r2.message.rest

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


                                                                   .errorResponse(filterErrorResponse).build();
    final RecordTemplate entityFromFilter2 = Foo.createFoo("Key", "Two");

    PartialRestResponse partialResponse = new PartialRestResponse.Builder().build();
    ArgumentCaptor<RestLiServiceException> wrappedExCapture = ArgumentCaptor.forClass(RestLiServiceException.class);
    RestResponse restResponse = new RestResponseBuilder().build();


    // Setup.
    when(
         _responseHandler.buildErrorResponseData(eq(_restRequest), eq(_routingResult),
View Full Code Here


  public void testSetValidHeader()
  {
    final String headerName = "testName";
    final String headerValue = "testValue";

    final RestResponse res = new RestResponseBuilder()
            .setHeader(headerName, headerValue)
            .build();

    Assert.assertEquals(headerValue, res.getHeader(headerName));
  }
View Full Code Here

  }

  @Test
  public void testChainBuildRestResponseFromRestResponseBuilder()
  {
    final RestResponse res = new RestResponseBuilder()
            .setEntity(new byte[] {1,2,3,4})
            .setHeader("k1", "v1")
            .setStatus(300)
            .build()
            .builder()
              .setEntity(new byte[] {5,6,7,8})
              .setHeader("k2", "v2")
              .setStatus(400)
              .build();

    Assert.assertEquals(new byte[] {5,6,7,8}, res.getEntity().copyBytes());
    Assert.assertEquals("v1", res.getHeader("k1"));
    Assert.assertEquals("v2", res.getHeader("k2"));
    Assert.assertEquals(400, res.getStatus());
  }
View Full Code Here

              .build();

    Assert.assertEquals(new byte[] {5,6,7,8}, res.getEntity().copyBytes());

    Assert.assertTrue(res instanceof RestResponse);
    final RestResponse restRes = (RestResponse)res;
    Assert.assertEquals("v1", restRes.getHeader("k1"));
    Assert.assertEquals(300, restRes.getStatus());
  }
View Full Code Here

    Assert.assertEquals(new byte[] {5,6,7,8}, res.getEntity().copyBytes());
    Assert.assertEquals("v1", res.getHeader("k1"));
    Assert.assertEquals("v2", res.getHeader("k2"));

    Assert.assertTrue(res instanceof RestResponse);
    final RestResponse restRes = (RestResponse)res;
    Assert.assertEquals(300, restRes.getStatus());
  }
View Full Code Here

              .build();

    Assert.assertEquals(new byte[] {5,6,7,8}, res.getEntity().copyBytes());

    Assert.assertTrue(res instanceof RestResponse);
    final RestResponse restRes = (RestResponse)res;
    Assert.assertEquals("v1", restRes.getHeader("k1"));
    Assert.assertEquals(300, restRes.getStatus());
  }
View Full Code Here

          _docRequestHandler.initialize(_config, _rootResources);
          _isDocInitialized = true;
        }
      }

      final RestResponse response = _docRequestHandler.processDocumentationRequest(request);
      callback.onSuccess(response);
    }
    catch (Exception e)
    {
      final RestLiCallback<Object> restLiCallback =
View Full Code Here

        else if (matcher.group(1).contains("BAD_REQUEST"))
        {
          status = RestStatus.BAD_REQUEST;
        }

        final RestResponse res = new RestResponseBuilder().setStatus(status).build();
        final RestException restException = new RestException(res);

        return restException.getResponse();
      }
    }
View Full Code Here

  }

  private ExampleRequestResponse buildRequestResponse(Request<?> request, Object responseEntity, ResourceMethodDescriptor method)
  {
    RestRequest restRequest = buildRequest(request);
    RestResponse restResponse = buildResponse(responseEntity, method, restRequest);
    return new ExampleRequestResponse(restRequest, restResponse);
  }
View Full Code Here

  public void restRequest(RestRequest request, RequestContext requestContext,
                          Callback<RestResponse> callback)
  {
    TransportCallback<RestResponse> adapter = HttpBridge.restToHttpCallback(new TransportCallbackAdapter<RestResponse>(callback), request);

    RestResponse response = new RestResponseBuilder()
            .setStatus(status())
            .setHeaders(headers())
            .setEntity(body())
            .build();
View Full Code Here

TOP

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

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.