本文整理汇总了Java中com.sun.jersey.api.client.ClientRequest.setURI方法的典型用法代码示例。如果您正苦于以下问题:Java ClientRequest.setURI方法的具体用法?Java ClientRequest.setURI怎么用?Java ClientRequest.setURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jersey.api.client.ClientRequest
的用法示例。
在下文中一共展示了ClientRequest.setURI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import com.sun.jersey.api.client.ClientRequest; //导入方法依赖的package包/类
@Override
public ClientResponse handle(ClientRequest cr) throws ClientHandlerException
{
URIBuilder uriBuilder = new URIBuilder(cr.getURI());
String path = uriBuilder.getPath();
uriBuilder.setPath(converter.convertCommandPath(path));
try {
cr.setURI(uriBuilder.build());
ClientResponse response = getNext().handle(cr);
String newEntity = converter.convertResponse(path, response.getEntity(String.class));
response.setEntityInputStream(new ByteArrayInputStream(newEntity.getBytes()));
return response;
} catch (Exception ex) {
throw new ClientHandlerException(ex);
}
}
示例2: addApiKey
import com.sun.jersey.api.client.ClientRequest; //导入方法依赖的package包/类
private void addApiKey(ClientRequest request) {
URI uriWithApiKey = UriBuilder.fromUri(request.getURI())
.queryParam(this.requestConfiguration.getApiKeyQueryParamName(), apiKey)
.build();
request.setURI(uriWithApiKey);
}
示例3: apply
import com.sun.jersey.api.client.ClientRequest; //导入方法依赖的package包/类
@Override
public void apply(ClientRequest request) {
UriBuilder builder = UriBuilder.fromUri(request.getURI());
builder = this.replace ? builder.replaceQueryParam(this.name, this.value) : builder.queryParam(this.name, this.value);
request.setURI(builder.build());
}