當前位置: 首頁>>代碼示例>>Java>>正文


Java RequestBuilder.put方法代碼示例

本文整理匯總了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);
}
 
開發者ID:zongtui,項目名稱:zongtui-webcrawler,代碼行數:24,代碼來源:HttpClientDownloader.java

示例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;
}
 
開發者ID:dasein-cloud,項目名稱:dasein-cloud-azurepack,代碼行數:8,代碼來源:AzurePackVMRequests.java

示例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;
}
 
開發者ID:dasein-cloud,項目名稱:dasein-cloud-azurepack,代碼行數:8,代碼來源:AzurePackVMRequests.java


注:本文中的org.apache.http.client.methods.RequestBuilder.put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。