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; }
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; }
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¶meter2=%s¶meter3=%s", encodedData1, encodedData2); final HttpUriRequest request = requestBuilder.build(); Assert.assertEquals(uriExpected, request.getURI().toString()); }