Package org.springframework.hateoas.client

Examples of org.springframework.hateoas.client.Browsable


    // enable client to submit form when encountered
    agent.addSubmitFormAction(new SubmitFormAction("searchPerson", Args.of("personId", personId)));

    agent.setGoal(describedBy("http://example.com/doc#product").within(describedBy("http://example.com/doc#customer")));
    Browsable result = agent.browseForGoal();

    System.out.println("\n--- result ---");
    System.out.println(result.toString());
    System.out.println("--------------\n");
  }
View Full Code Here


    // enable client to submit forms
    // TODO: look into schema.org actions to see if they say something about required data for an action.
    agent.addSubmitFormAction(new SubmitFormAction("bankAccountForm", Args.of("accountNumber", fromAccount)));
    agent.addSubmitFormAction(new SubmitFormAction("moneyTransferForm", Args.of("amount", amount, "to", toAccount)));

    Browsable result = agent.browseForGoal();
    System.out.println("\n--- result ---");
    System.out.println(result.toString());
    System.out.println("--------------\n");
  }
View Full Code Here

    response.setEntity(entity);

    // expect
    when(navigatorRegistry.getBrowsable("text/xhtml")).thenReturn(expectedBrowsable);

    Browsable browsable = handler.handleResponse(response);
    assertSame(expectedBrowsable, browsable);
    verify(expectedBrowsable).process(Mockito.<InputStream> any(), Mockito.<HttpHeaders> any());
  }
View Full Code Here

    response.setEntity(entity);

    // expect
    when(navigatorRegistry.getBrowsable("application/xhtml+xml")).thenReturn(expectedBrowsable);

    Browsable navigator = handler.handleResponse(response);

    assertSame(expectedBrowsable, navigator);
    verify(expectedBrowsable).process(Mockito.<InputStream> any(), Mockito.<HttpHeaders> any());
  }
View Full Code Here

    when(searchForm.getFormRequest(Mockito.eq("people"), Mockito.<Args> any())).thenReturn(
        new FormRequest(HttpMethod.GET, new LinkedMultiValueMap<String, String>(), new URI("/"), "", "UTF-8"));

    browser.followRel("search").submitForm("people", Args.of("customerId", 1));

    Browsable currentResource = browser.getCurrentResource();

    assertSame(result, currentResource);
  }
View Full Code Here

  private Browsable followLink(Link target) {
    try {
      ResponseHandler<Browsable> responseHandler = new BrowsableResponseHandler();
      URI uri = new URI(target.getHref());
      HttpGet httpGet = createGet(uri);
      Browsable browsable = httpClient.execute(httpGet, responseHandler);
      setCurrentContext(uri);
      return browsable;
    } catch (Exception e) {
      throw Failure.asUnchecked(e);
    }
View Full Code Here

    if (elements.length != 1) {
      throw new IllegalArgumentException("more than one response mime type currently not supported");
    }
    String mimeType = elements[0].getName();

    Browsable browsable = browsableRegistry.getBrowsable(mimeType);

    // navigator.setURL(response.);

    HttpHeaders httpHeaders = toHttpHeaders(response.getAllHeaders());

    browsable.process(inputStream, httpHeaders);

    return browsable;

  }
View Full Code Here

TOP

Related Classes of org.springframework.hateoas.client.Browsable

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.