Package org.restlet.data

Examples of org.restlet.data.Response


   
   
    String URL = BASE_URL+"statuses/friends/"+getScreenName()+".xml";
    Request request = new Request(Method.GET, URL);
    auth(request);   
    Response response = client.handle(request);
    try {
      //System.out.println(response.getStatus()+response.getEntity().getText());
      UserStatusList s = (UserStatusList) xstream.unmarshal(
          new DomReader(response.getEntityAsDom().getDocument()));
      System.out.println(s.getUserList().size());
      for(UserStatus it : s.getUserList()){
        System.out.println(it);
      }
     
View Full Code Here


        if (LOG.isDebugEnabled()) {
            LOG.debug("Client sends a request (method: " + request.getMethod()
                    + ", uri: " + resourceUri + ")");
        }
       
        Response response = client.handle(request);
        binding.populateExchangeFromRestletResponse(exchange, response);
    }
View Full Code Here

  }

  public List<ContentListResource> getContentListResource(String repoId, String path, boolean isGroup)
      throws IOException
  {
    Response response = this.getResponse(repoId, path, isGroup);

    String responeText = response.getEntity().getText();
    Assert.assertTrue(
        "Expected sucess: Status was: " + response.getStatus() + "\nResponse:\n" + responeText,
        response.getStatus().isSuccess());

    XStreamRepresentation representation = new XStreamRepresentation(this.xstream, responeText, this.mediaType);
    ContentListResourceResponse listRepsonse = (ContentListResourceResponse) representation
        .getPayload(new ContentListResourceResponse());
View Full Code Here

      }
      else {
        serviceURI = "service/local/data_cache/repositories/" + repo + "/content";
      }

      final Response response = RequestFacade.sendMessage(serviceURI, Method.DELETE);
      final Status status = response.getStatus();
      assertThat("Fail to update " + repo + " repository index " + status, status.isSuccess(), is(true));
    }

    // let w8 a few time for indexes
    waitForAllTasksToStop();
View Full Code Here

      throws Exception
  {
    final String url = "content/repositories/" + getTestRepositoryId() + "/content.xml";

    // init local storage
    Response content = null;
    String metadataBefore;
    try {
      content = RequestFacade.sendMessage(url, Method.GET);
      metadataBefore = content.getEntity().getText();
    }
    finally {
      RequestFacade.releaseResponse(content);
    }

    assertThat(metadataBefore, containsString("<?metadataRepository"));

    // invalidate remote repo
    replaceProxy();

    // check delivery from local storage
    String metadataAfter;
    try {
      content = RequestFacade.sendMessage(url, Method.GET);
      metadataAfter = content.getEntity().getText();
    }
    finally {
      RequestFacade.releaseResponse(content);
    }
View Full Code Here

  public String doGetForText(final String serviceURIpart, final XStreamRepresentation representation,
                             Matcher<Response> responseMatcher)
      throws IOException
  {
    checkNotNull(serviceURIpart);
    Response response = null;
    try {
      // deliberately passing null for matcher since we do the check after getting the text below.
      response = sendMessage(toNexusURL(serviceURIpart), Method.GET, representation, null);
      final Representation entity = response.getEntity();
      assertThat(entity, notNullValue());
      final String responseText = entity.getText();
      if (responseMatcher != null) {
        assertThat(response, responseMatcher);
      }
View Full Code Here

   */
  public Status doGetForStatus(final String serviceURIpart, Matcher<Status> matcher)
      throws IOException
  {
    checkNotNull(serviceURIpart);
    Response response = null;
    try {
      response = sendMessage(serviceURIpart, Method.GET);
      Status status = response.getStatus();
      assertThat(status, notNullValue());
      if (matcher != null) {
        assertThat(status, matcher);
      }

View Full Code Here

  public void doGet(final String serviceURIpart, Matcher<Response> matcher)
      throws IOException
  {
    checkNotNull(serviceURIpart);
    Response response = doGetRequest(serviceURIpart);
    try {
      assertThat(response, matcher);
    }
    finally {
      releaseResponse(response);
View Full Code Here

  public void doPut(final String serviceURIpart, final XStreamRepresentation representation,
                    Matcher<Response> matcher)
      throws IOException
  {
    Response response = null;
    try {
      response = sendMessage(toNexusURL(serviceURIpart), Method.PUT, representation, matcher);
    }
    finally {
      releaseResponse(response);
View Full Code Here

   */
  public Status doPutForStatus(final String serviceURIpart, final XStreamRepresentation representation,
                               Matcher<Response> matcher)
      throws IOException
  {
    Response response = null;
    try {
      response = sendMessage(toNexusURL(serviceURIpart), Method.PUT, representation, matcher);
      return extractStatus(response);
    }
    finally {
View Full Code Here

TOP

Related Classes of org.restlet.data.Response

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.