コード例 #1
0
 public RequestBuilder listTemplates() {
   RequestBuilder requestBuilder = RequestBuilder.get();
   addCommonHeaders(requestBuilder);
   requestBuilder.setUri(
       String.format(
           VMTEMPLATES_RESOURCES,
           this.provider.getContext().getEndpoint(),
           this.provider.getContext().getAccountNumber()));
   return requestBuilder;
 }
コード例 #2
0
 public RequestBuilder listVirtualDisks() {
   RequestBuilder requestBuilder = RequestBuilder.get();
   addCommonHeaders(requestBuilder);
   requestBuilder.setUri(
       String.format(
           VHD_RESOURCES,
           this.provider.getContext().getEndpoint(),
           this.provider.getContext().getAccountNumber()));
   return requestBuilder;
 }
コード例 #3
0
  private void assertBuild(final Charset charset) throws Exception {
    final RequestBuilder requestBuilder = RequestBuilder.create("GET").setCharset(charset);
    requestBuilder.setUri("https://somehost.com/stuff");
    requestBuilder.addParameters(createParameters());

    final String encodedData1 = URLEncoder.encode("\"1\u00aa position\"", charset.displayName());
    final String encodedData2 = URLEncoder.encode("Jos\u00e9 Abra\u00e3o", charset.displayName());

    final String uriExpected =
        String.format(
            "https://somehost.com/stuff?parameter1=value1&parameter2=%s&parameter3=%s",
            encodedData1, encodedData2);

    final HttpUriRequest request = requestBuilder.build();
    Assert.assertEquals(uriExpected, request.getURI().toString());
  }