Package com.linkedin.r2.message.rest

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


  public void testActionRootRouting(ProtocolVersion version, String uri) throws Exception
  {
    Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(TwitterAccountsResource.class);
    _router = new RestLiRouter(pathRootResourceMap);

    RestRequest request = createRequest(uri, "POST", version);
    RoutingResult result = _router.process(request, new RequestContext());
    assertNotNull(result);
    assertEquals(result.getResourceMethod().getActionName(), "register");
    assertEquals(result.getResourceMethod().getType(), ResourceMethod.ACTION);
  }
View Full Code Here


  }

  @Test
  public void testRestRequestReversible5() throws IOException
  {
    final RestRequest req = createRestRequest().builder()
            .setHeader("field-key1", "multi-line\nfield-value\nhere")
            .build();
    assertMsgEquals(req, readRestReq(writeReq(req)));
  }
View Full Code Here

    Map<String, ResourceModel> pathRootResourceMap =
      buildResourceModels(StatusCollectionResource.class,
                          RepliesCollectionResource.class);
    _router = new RestLiRouter(pathRootResourceMap);

    RestRequest request = createRequest(uri, "POST", version);
    RoutingResult result = _router.process(request, new RequestContext());
    assertNotNull(result);
    assertEquals(result.getResourceMethod().getActionName(), "replyToAll");
    assertEquals(result.getResourceMethod().getType(), ResourceMethod.ACTION);
    assertEquals(result.getContext().getPathKeys().get("statusID"), 1L);
View Full Code Here

    Map<String, ResourceModel> pathRootResourceMap =
      buildResourceModels(StatusCollectionResource.class,
                          LocationResource.class);
    _router = new RestLiRouter(pathRootResourceMap);

    RestRequest request = createRequest(uri, "POST", version);
    RoutingResult result = _router.process(request, new RequestContext());
    assertNotNull(result);
    assertEquals(result.getResourceMethod().getActionName(), "new_status_from_location");
    assertEquals(result.getResourceMethod().getType(), ResourceMethod.ACTION);
    assertEquals(result.getResourceMethod().getMethod().getParameterTypes(), new Class<?>[] { String.class });
View Full Code Here

    RestRequestBuilder builder = createRequestBuilder(uri, httpMethod, version);
    if (restliMethod != null)
    {
      builder.setHeader("X-RestLi-Method", restliMethod);
    }
    RestRequest request = builder.build();
    RoutingResult result = _router.process(request, new RequestContext());

    assertEquals(result.getResourceMethod().getType(), method);
    assertEquals(result.getResourceMethod().getResourceModel().getResourceClass(), resourceClass);
    assertEquals(result.getResourceMethod().getMethod().getName(), methodName);
View Full Code Here

                              ProtocolVersion version,
                              String httpMethod,
                              Set<?> batchCompoundKeys)
      throws URISyntaxException
  {
    RestRequest request = createRequest(uri, httpMethod, version);
    RoutingResult result = _router.process(request, new RequestContext());
    Set<?> batchKeys = result.getContext().getPathKeys().getBatchIds();
    assertEquals(batchKeys, batchCompoundKeys);
  }
View Full Code Here

    RestRequestBuilder builder = createRequestBuilder(uri, httpMethod, version);
    if (restliMethod != null)
    {
      builder.setHeader("X-RestLi-Method", restliMethod);
    }
    RestRequest request = builder.build();
    try
    {
      RoutingResult r = _router.process(request, new RequestContext());
      fail("Expected RoutingException, got: " + r.toString());
    }
View Full Code Here

    Map<String, ResourceModel> pathRootResourceMap =
      buildResourceModels(CombinedResources.CombinedCollectionWithSubresources.class,
                          CombinedResources.SubCollectionResource.class);
    _router = new RestLiRouter(pathRootResourceMap);

    RestRequest request;
    RoutingResult result;

    // #1 simple GET
    request = createRequest(uri, "GET", version);
View Full Code Here

  @Override
  public void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException,
                                                                                                 IOException
  {
    RestRequest restRequest;

    try
    {
      restRequest = readFromServletRequest(req);
    }
View Full Code Here

  @Test
  public void testRestToHttpErrorMessage() throws TimeoutException, InterruptedException
  {
    URI uri = URI.create("http://some.host/thisShouldAppearInTheErrorMessage");

    RestRequest r = new RestRequestBuilder(uri).build();

    FutureCallback<RestResponse> futureCallback = new FutureCallback<RestResponse>();
    TransportCallback<RestResponse> callback = new TransportCallbackAdapter<RestResponse>(futureCallback);
    TransportCallback<RestResponse> bridgeCallback = HttpBridge.restToHttpCallback(callback, r);
View Full Code Here

TOP

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

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.