本文整理了Java中javax.ws.rs.core.UriBuilder.segment()
方法的一些代码示例,展示了UriBuilder.segment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UriBuilder.segment()
方法的具体详情如下:
包路径:javax.ws.rs.core.UriBuilder
类名称:UriBuilder
方法名:segment
[英]Append path segments to the existing path. When constructing the final path, a '/' separator will be inserted between the existing path and the first path segment if necessary and each supplied segment will also be separated by '/'. Existing '/' characters are encoded thus a single value can only represent a single URI path segment.
[中]将路径段附加到现有路径。在构建最终路径时,如果需要,将在现有路径和第一个路径段之间插入“/”分隔符,每个提供的段也将用“/”分隔。现有的“/”字符是经过编码的,因此单个值只能表示单个URI路径段。
代码示例来源:origin: apache/nifi
private URI buildResourceUri(final String... path) {
final UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.segment(path);
URI uri = uriBuilder.build();
try {
代码示例来源:origin: apache/nifi
uriBuilder.segment("process-groups", groupId, "templates", "import");
final URI importUri = uriBuilder.build();
代码示例来源:origin: com.bazaarvoice.emodb/emodb-blob-client-common
private URI toUri(String table, String blobId) {
return _blobStore.clone().segment(table, blobId).build();
}
代码示例来源:origin: bazaarvoice/emodb
private URI toUri(String table, String blobId) {
return _blobStore.clone().segment(table, blobId).build();
}
代码示例来源:origin: bazaarvoice/emodb
protected UriBuilder getPollUriBuilder(String subscription, Duration claimTtl, int limit) {
return _databus.clone()
.segment(subscription, "poll")
.queryParam("ttl", Ttls.toSeconds(claimTtl, 0, Integer.MAX_VALUE))
.queryParam("limit", limit)
.queryParam("partitioned", _partitionSafe);
}
代码示例来源:origin: arquillian/continuous-enterprise-development
@GET
@Produces({BASE_XML_MEDIA_TYPE, BASE_JSON_MEDIA_TYPE})
public Response whoami() {
User currentUser = user.get();
if(currentUser == null) {
return Response.status(Status.UNAUTHORIZED).build();
}
String userId = currentUser.getId();
return Response.seeOther(
UriBuilder.fromResource(UserResource.class).segment(userId).build())
.build();
}
}
代码示例来源:origin: bazaarvoice/ostrich
@Override
public boolean contains(@PartitionKey String word) {
try {
URI uri = _service.clone().segment("contains", word).build();
return _client
.target(_service)
.path("contains")
.path(word)
.request()
.get(Boolean.class);
} catch (WebApplicationException e) {
throw convertException(e);
}
}
代码示例来源:origin: bazaarvoice/emodb
@Override
public EmoApiKey getApiKeyByKey(String apiKey, String key) {
checkNotNull(key, "key");
URI uri = _uac.clone()
.segment("api-key")
.segment("_key")
.segment(key)
.build();
EmoResponse response = _client.resource(uri)
.accept(MediaType.APPLICATION_JSON_TYPE)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.get(EmoResponse.class);
return getApiKeyFromResponse(response);
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
@GET
@Consumes({ "application/xml", "text/xml", "application/json" })
public Employee get(@Context
UriInfo uriInfo) {
// load employee with requested id
final Employee employee = this.employeeMgr.getFull(this.staffNo);
// set department uri
final UriBuilder departmentUB = uriInfo.getBaseUriBuilder();
departmentUB.segment("departments", "{depId}");
final String department = employee.getDepartment();
employee.setDepartmentUri(departmentUB.build(department));
return employee;
}
代码示例来源:origin: bazaarvoice/jersey-hmac-auth
public Pizza getPizza() {
URI uri = uriBuilder.clone()
.segment("pizza")
.build();
return jerseyClient.resource(uri)
.accept(MediaType.APPLICATION_JSON_TYPE)
.get(Pizza.class);
}
代码示例来源:origin: bazaarvoice/emodb
@Override
public EmoApiKey getApiKey(String apiKey, String id) {
checkNotNull(id, "id");
URI uri = _uac.clone()
.segment("api-key")
.segment(id)
.build();
EmoResponse response = _client.resource(uri)
.accept(MediaType.APPLICATION_JSON_TYPE)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.get(EmoResponse.class);
return getApiKeyFromResponse(response);
}
代码示例来源:origin: arquillian/continuous-enterprise-development
@POST
@Consumes({ BASE_JSON_MEDIA_TYPE, BASE_XML_MEDIA_TYPE })
public Response create(REP representation) {
DOMAIN entity = getConverter().to(uriInfo, representation);
getRepository().store(entity);
return Response.created(
UriBuilder.fromResource(getResourceClass()).segment("{id}").build(entity.getId())).build();
}
代码示例来源:origin: bazaarvoice/emodb
protected void doUnclaimAll(String apiKey, String queue) {
checkNotNull(queue, "queue");
try {
URI uri = _queueService.clone()
.segment(queue, "unclaimall")
.queryParam("partitioned", _partitionSafe)
.build();
_client.resource(uri)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.post();
} catch (EmoClientException e) {
throw convertException(e);
}
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-sor-client-common
@Override
public Map<String, Object> getTableTemplate(String apiKey, String table) {
checkNotNull(table, "table");
try {
URI uri = _dataStore.clone()
.segment("_table", table)
.build();
return _client.resource(uri)
.accept(MediaType.APPLICATION_JSON_TYPE)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.get(new TypeReference<Map<String,Object>>(){});
} catch (EmoClientException e) {
throw convertException(e);
}
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-blob-client-common
@Override
public long getTableApproximateSize(String apiKey, String table) {
checkNotNull(table, "table");
try {
URI uri = _blobStore.clone()
.segment("_table", table, "size")
.build();
return _client.resource(uri)
.accept(MediaType.APPLICATION_JSON_TYPE)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.get(Long.class);
} catch (EmoClientException e) {
throw convertException(e);
}
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-sor-client
@Override
public Map<StashTimeKey, StashRunTimeInfo> getAllStashTimes() {
try {
URI uri = _compactionControlSource.clone()
.segment("_compcontrol", "stash-time")
.build();
return _client.resource(uri)
.type(MediaType.APPLICATION_JSON_TYPE)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, _apiKey)
.get(Map.class);
} catch (UniformInterfaceException e) {
throw convertException(e);
}
}
代码示例来源:origin: bazaarvoice/emodb
@Override
public Map<StashTimeKey, StashRunTimeInfo> getAllStashTimes() {
try {
URI uri = _compactionControlSource.clone()
.segment("_compcontrol", "stash-time")
.build();
return _client.resource(uri)
.type(MediaType.APPLICATION_JSON_TYPE)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, _apiKey)
.get(Map.class);
} catch (UniformInterfaceException e) {
throw convertException(e);
}
}
代码示例来源:origin: bazaarvoice/emodb
@Override
public Iterator<EmoRole> getAllRoles(String apiKey) {
try {
URI uri = _uac.clone()
.segment("role")
.build();
return _client.resource(uri)
.accept(MediaType.APPLICATION_JSON_TYPE)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.get(new TypeReference<Iterator<EmoRole>>(){});
} catch (EmoClientException e) {
throw convertException(e);
}
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-blob-client-common
@Override
public Collection<String> getTablePlacements(String apiKey) {
try {
URI uri = _blobStore.clone()
.segment("_tableplacement")
.build();
return _client.resource(uri)
.accept(MediaType.APPLICATION_JSON_TYPE)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.get(new TypeReference<List<String>>(){});
} catch (EmoClientException e) {
throw convertException(e);
}
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-sor-client-common
@Override
public Collection<String> getTablePlacements(String apiKey) {
try {
URI uri = _dataStore.clone()
.segment("_tableplacement")
.build();
return _client.resource(uri)
.accept(MediaType.APPLICATION_JSON_TYPE)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.get(new TypeReference<List<String>>(){});
} catch (EmoClientException e) {
throw convertException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!