当前位置: 首页>>代码示例>>Java>>正文


Java Request.Put方法代码示例

本文整理汇总了Java中org.apache.http.client.fluent.Request.Put方法的典型用法代码示例。如果您正苦于以下问题:Java Request.Put方法的具体用法?Java Request.Put怎么用?Java Request.Put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.http.client.fluent.Request的用法示例。


在下文中一共展示了Request.Put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: put

import org.apache.http.client.fluent.Request; //导入方法依赖的package包/类
/**
 * Send PUT request with authorization header
 * @param url - The url of the POST request
 * @param auth - String for authorization header
 * @param putData - The body of the PUT
 */
public Response put(String url, String auth, JsonJavaObject putData) throws URISyntaxException, IOException, JsonException {
	URI normUri = new URI(url).normalize();
	Request putRequest = Request.Put(normUri);
	
	//Add auth header
	if(StringUtil.isNotEmpty(auth)) {
		putRequest.addHeader("Authorization", auth);
	}
	
	//Add put data
	String putDataString = JsonGenerator.toJson(JsonJavaFactory.instanceEx, putData);
	if(putData != null) {
		putRequest = putRequest.bodyString(putDataString, ContentType.APPLICATION_JSON);
	}
	
	Response response = executor.execute(putRequest);
	return response;
}
 
开发者ID:OpenNTF,项目名称:XPages-Fusion-Application,代码行数:25,代码来源:RestUtil.java

示例2: put

import org.apache.http.client.fluent.Request; //导入方法依赖的package包/类
private Response put(HttpRequest request) throws IOException {
    Request apacheRequest = Request.Put(request.getUrl());
    if (request.getBody() != null) {
        ContentType ct = ContentType.create(request.getContentType().getMimeType(),
                        request.getContentType().getCharset());
        apacheRequest.bodyString(request.getBody(), ct);
    } else if (request.getBodyForm() != null) {
        apacheRequest.bodyForm(buildFormBody(request.getBodyForm()));
    }
    prepareRequest(apacheRequest);
    return apacheRequest.execute();
}
 
开发者ID:DorsetProject,项目名称:dorset-framework,代码行数:13,代码来源:ApacheHttpClient.java

示例3: put

import org.apache.http.client.fluent.Request; //导入方法依赖的package包/类
HttpClientResponseDTO put(final HttpClientCallDTO reqDto) throws IOException {

        final Request request = Request.Put(reqDto.getUrl());

        handleRequestData(request, reqDto.getHeaders(), reqDto);

        return executeRequest(request, reqDto.getHeaders());
    }
 
开发者ID:mgtechsoftware,项目名称:smockin,代码行数:9,代码来源:HttpClientServiceImpl.java


注:本文中的org.apache.http.client.fluent.Request.Put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。