本文整理匯總了Java中org.apache.http.client.methods.RequestBuilder.put方法的典型用法代碼示例。如果您正苦於以下問題:Java RequestBuilder.put方法的具體用法?Java RequestBuilder.put怎麽用?Java RequestBuilder.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.http.client.methods.RequestBuilder
的用法示例。
在下文中一共展示了RequestBuilder.put方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: selectRequestMethod
import org.apache.http.client.methods.RequestBuilder; //導入方法依賴的package包/類
protected RequestBuilder selectRequestMethod(Request request) {
String method = request.getMethod();
if (method == null || method.equalsIgnoreCase(HttpConstant.Method.GET)) {
//default get
return RequestBuilder.get();
} else if (method.equalsIgnoreCase(HttpConstant.Method.POST)) {
RequestBuilder requestBuilder = RequestBuilder.post();
NameValuePair[] nameValuePair = (NameValuePair[]) request.getExtra("nameValuePair");
if (nameValuePair != null && nameValuePair.length > 0) {
requestBuilder.addParameters(nameValuePair);
}
return requestBuilder;
} else if (method.equalsIgnoreCase(HttpConstant.Method.HEAD)) {
return RequestBuilder.head();
} else if (method.equalsIgnoreCase(HttpConstant.Method.PUT)) {
return RequestBuilder.put();
} else if (method.equalsIgnoreCase(HttpConstant.Method.DELETE)) {
return RequestBuilder.delete();
} else if (method.equalsIgnoreCase(HttpConstant.Method.TRACE)) {
return RequestBuilder.trace();
}
throw new IllegalArgumentException("Illegal HTTP Method " + method);
}
示例2: updateNetworkAdapter
import org.apache.http.client.methods.RequestBuilder; //導入方法依賴的package包/類
public RequestBuilder updateNetworkAdapter(WAPVirtualNetworkAdapter virtualNetworkAdapter) throws InternalException {
RequestBuilder requestBuilder = RequestBuilder.put();
addCommonHeaders(requestBuilder);
requestBuilder.setUri(getEncodedUri(String.format(VIRTUAL_NETWORK_ADAPTER, this.provider.getContext().getEndpoint(), this.provider.getContext().getAccountNumber(), virtualNetworkAdapter.getStampId(), virtualNetworkAdapter.getId())));
requestBuilder.setEntity(new DaseinObjectToJsonEntity<WAPVirtualNetworkAdapter>(virtualNetworkAdapter));
return requestBuilder;
}
示例3: updateVirtualMachine
import org.apache.http.client.methods.RequestBuilder; //導入方法依賴的package包/類
public RequestBuilder updateVirtualMachine(String vmId, String dataCenterId, WAPVirtualMachineModel virtualMachineModel) throws InternalException {
RequestBuilder requestBuilder = RequestBuilder.put();
addCommonHeaders(requestBuilder);
requestBuilder.setUri(getEncodedUri(String.format(VM_RESOURCES, this.provider.getContext().getEndpoint(), this.provider.getContext().getAccountNumber(), dataCenterId, vmId)));
requestBuilder.setEntity(new DaseinObjectToJsonEntity<WAPVirtualMachineModel>(virtualMachineModel));
return requestBuilder;
}