Package com.linkedin.restli.server

Examples of com.linkedin.restli.server.CreateResponse


  @Override
  public CreateResponse create(final Greeting greeting)
  {
    // just echo back the provided id (for testing only, this would not a be correct implementation of POST)
    return new CreateResponse(new CustomLong(greeting.getId()));
  }
View Full Code Here


  {
    List<CreateResponse> results = new ArrayList<CreateResponse>();
    for (Greeting greeting: entities.getInput())
    {
      // just echo back the provided ids (for testing only, this would not a be correct implementation of POST)
      results.add(new CreateResponse(new CustomLong(greeting.getId()), HttpStatus.S_204_NO_CONTENT));
    }
    return new BatchCreateResult<CustomLong, Greeting>(results);
  }
View Full Code Here

  @Test(dataProvider = "testData")
  public void testBuilder(ProtocolVersion protocolVersion, String location, String id)
      throws URISyntaxException
  {
    CompoundKey compoundKey = new CompoundKey().append("a", "a").append("b", 1);
    CreateResponse createResponse = new CreateResponse(compoundKey);
    IdResponse<CompoundKey> idResponse = new IdResponse<CompoundKey>(compoundKey);
    RestRequest restRequest = new RestRequestBuilder(new URI("/foo")).build();
    Map<String, String> headers = getHeaders(protocolVersion);
    // the headers passed in are modified
    Map<String, String> expectedHeaders = new HashMap<String, String>(headers);
View Full Code Here

  @Test
  public void testBuilderException()
      throws URISyntaxException
  {
    CompoundKey compoundKey = new CompoundKey().append("a", "a").append("b", 1);
    CreateResponse createResponse = new CreateResponse(compoundKey, null);
    RestRequest restRequest = new RestRequestBuilder(new URI("/foo")).build();
    ProtocolVersion protocolVersion = AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion();
    Map<String, String> headers = getHeaders(protocolVersion);

    ResourceMethodDescriptor mockDescriptor = getMockResourceMethodDescriptor();
View Full Code Here

      notAcceptableException.setServiceErrorCode(999);
      throw notAcceptableException;
    }
    else
    {
      return new CreateResponse(g.getId(), HttpStatus.S_201_CREATED);
    }
  }
View Full Code Here

      {
        responses.add(create(g));
      }
      catch (RestLiServiceException restliException)
      {
        responses.add(new CreateResponse(restliException));
      }
    }
    return new BatchCreateResult<Long, Greeting>(responses);
  }
View Full Code Here

  @RestMethod.Create
  public CreateResponse create(Message entity)
  {
    _db.put(entity.getId().toString(), entity);
    return new CreateResponse(entity.getId());
  }
View Full Code Here

  {
    final Runnable requestHandler = new Runnable()
    {
      public void run()
      {
        callback.onSuccess(new CreateResponse(HttpStatus.S_200_OK));
      }
    };
    scheduler.schedule(requestHandler, DELAY, TimeUnit.MILLISECONDS);
  }
View Full Code Here

    ComplexResourceKey<GroupMembershipKey, GroupMembershipParam> complexResourceKey =
        new ComplexResourceKey<GroupMembershipKey, GroupMembershipParam>(groupMembershipKey,
                                                                         new GroupMembershipParam());
    groupMembership.setId(complexResourceKey.getKey());
    _app.getMembershipMgr().save(toGroupMembership(groupMembership));
    return new CreateResponse(complexResourceKey, HttpStatus.S_201_CREATED);
  }
View Full Code Here

    final SettablePromise<CreateResponse> result = Promises.settable();
    final Runnable requestHandler = new Runnable() {
      public void run()
      {
        ComplexResourceKey<TwoPartKey, TwoPartKey> key = _dataProvider.create(message);
        result.done(new CreateResponse(key));
      }
    };

    _scheduler.schedule(requestHandler, DELAY, TimeUnit.MILLISECONDS);
View Full Code Here

TOP

Related Classes of com.linkedin.restli.server.CreateResponse

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.