예제 #1
0
 private RequestBuilder postRequestBuilder() {
   // lazy init, because endpointConfig.getUrl() is not initialized at construction time
   if (prb == null) {
     prb = new RequestBuilder(RequestBuilder.POST, endpointConfig.getUrl());
     prb.setHeader(HEADER_ACCEPT, DMR_ENCODED);
     prb.setHeader(HEADER_CONTENT_TYPE, DMR_ENCODED);
     prb.setIncludeCredentials(true);
   }
   return prb;
 }
예제 #2
0
 private RequestBuilder chooseRequestBuilder(final ModelNode operation) {
   RequestBuilder requestBuilder;
   final String op = operation.get(OP).asString();
   if (READ_RESOURCE_DESCRIPTION_OPERATION.equals(op)) {
     String endpoint = endpointConfig.getUrl();
     if (endpoint.endsWith("/")) {
       endpoint = endpoint.substring(0, endpoint.length() - 1);
     }
     String descriptionUrl = endpoint + descriptionOperationToUrl(operation);
     requestBuilder =
         new RequestBuilder(
             RequestBuilder.GET, com.google.gwt.http.client.URL.encode(descriptionUrl));
     requestBuilder.setHeader(HEADER_ACCEPT, DMR_ENCODED);
     requestBuilder.setHeader(HEADER_CONTENT_TYPE, DMR_ENCODED);
     requestBuilder.setIncludeCredentials(true);
     requestBuilder.setRequestData(null);
   } else {
     requestBuilder = postRequestBuilder();
     requestBuilder.setRequestData(operation.toBase64String());
   }
   return requestBuilder;
 }