/** * This class wraps HTTP-Method functionality and thereby abstracts from low * level code to simplify the usage. */ package org.opentosca.bpel4restlight.rest; import org.apache.commons.httpclient.HttpMethodBase; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.DeleteMethod; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpHeaders; public class HighLevelRestApi { protected static final Log log = LogFactory.getLog(HighLevelRestApi.class); /** * This method implements the HTTP Put Method * * @param uri * Resource URI * @param requestPayload * Content which has to be put into the Resource * @return ResponseCode of HTTP Interaction */ @SuppressWarnings("deprecation") public static HttpResponseMessage Put(String uri, String requestPayload, String acceptHeaderValue, String contentTypeHeader) { PutMethod method = new PutMethod(uri); // requestPayload = "" + // requestPayload; HighLevelRestApi.setHeader(method, acceptHeaderValue, contentTypeHeader); method.setRequestBody(requestPayload); HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); // kill ", ""); responseMessage.setResponseBody(temp); } } }