本文整理匯總了Java中javax.ws.rs.core.UriBuilder.fromPath方法的典型用法代碼示例。如果您正苦於以下問題:Java UriBuilder.fromPath方法的具體用法?Java UriBuilder.fromPath怎麽用?Java UriBuilder.fromPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.ws.rs.core.UriBuilder
的用法示例。
在下文中一共展示了UriBuilder.fromPath方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTenant
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public GetTenantResponse getTenant(@PathVariable("tenant") String tenantName) {
final TenantContext tenantContext = tenantRegistry.getTenantContext(tenantName);
final String tenantNameNormalized = tenantContext.getTenantName();
final UriBuilder uriBuilder = UriBuilder.fromPath("/{tenant}/{datasource}");
final List<String> dataContextIdentifiers = tenantContext.getDataSourceRegistry().getDataSourceNames();
final List<GetTenantResponseDatasources> dataSourceLinks = dataContextIdentifiers.stream().map(s -> {
final String uri = uriBuilder.build(tenantNameNormalized, s).toString();
return new GetTenantResponseDatasources().name(s).uri(uri);
}).collect(Collectors.toList());
final GetTenantResponse resp = new GetTenantResponse();
resp.type("tenant");
resp.name(tenantNameNormalized);
resp.datasources(dataSourceLinks);
return resp;
}
示例2: setUpStubForAssertionConsumerServiceUri
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
public void setUpStubForAssertionConsumerServiceUri(String entityId, Optional<Integer> assertionConsumerServiceIndex) throws JsonProcessingException {
UriBuilder uriBuilder = UriBuilder.fromPath(Urls.ConfigUrls.TRANSACTIONS_ASSERTION_CONSUMER_SERVICE_URI_RESOURCE);
if (assertionConsumerServiceIndex.isPresent()) {
uriBuilder.queryParam(Urls.ConfigUrls.ASSERTION_CONSUMER_SERVICE_INDEX_PARAM, assertionConsumerServiceIndex.get().toString());
}
URI uri = uriBuilder.buildFromEncoded(StringEncoding.urlEncode(entityId).replace("+", "%20"));
register(uri.toString(), OK, new ResourceLocation(URI.create("thisIsAnRpPostEndpointUri")));
}
示例3: get
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public GetDatasourceResponse get(@PathVariable("tenant") String tenantId,
@PathVariable("datasource") String dataSourceName) {
final TenantContext tenantContext = tenantRegistry.getTenantContext(tenantId);
final String tenantName = tenantContext.getTenantName();
final UriBuilder uriBuilder = UriBuilder.fromPath("/{tenant}/{dataContext}/s/{schema}");
List<GetDatasourceResponseSchemas> schemaLinks;
Boolean updateable;
try {
final DataContext dataContext = tenantContext.getDataSourceRegistry().openDataContext(dataSourceName);
updateable = dataContext instanceof UpdateableDataContext;
schemaLinks = dataContext.getSchemaNames().stream().map(s -> {
final String uri = uriBuilder.build(tenantName, dataSourceName, s).toString();
return new GetDatasourceResponseSchemas().name(s).uri(uri);
}).collect(Collectors.toList());
} catch (Exception e) {
logger.warn("Failed to open for GET datasource '{}/{}'. No schemas will be listed.", tenantId,
dataSourceName, e);
updateable = null;
schemaLinks = null;
}
final GetDatasourceResponse resp = new GetDatasourceResponse();
resp.type("datasource");
resp.name(dataSourceName);
resp.tenant(tenantName);
resp.updateable(updateable);
resp.queryUri(
UriBuilder.fromPath("/{tenant}/{dataContext}/query").build(tenantName, dataSourceName).toString());
resp.schemas(schemaLinks);
return resp;
}
示例4: get
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public GetSchemaResponse get(@PathVariable("tenant") String tenantId,
@PathVariable("dataContext") String dataSourceName, @PathVariable("schema") String schemaId) {
final TenantContext tenantContext = tenantRegistry.getTenantContext(tenantId);
final DataContext dataContext = tenantContext.getDataSourceRegistry().openDataContext(dataSourceName);
final DataContextTraverser traverser = new DataContextTraverser(dataContext);
final Schema schema = traverser.getSchema(schemaId);
final String tenantName = tenantContext.getTenantName();
final UriBuilder uriBuilder = UriBuilder.fromPath("/{tenant}/{dataContext}/s/{schema}/t/{table}");
final String schemaName = schema.getName();
final List<GetSchemaResponseTables> tableLinks = schema.getTableNames().stream().map(t -> {
final String uri = uriBuilder.build(tenantName, dataSourceName, schemaName, t).toString();
return new GetSchemaResponseTables().name(String.valueOf(t)).uri(uri);
}).collect(Collectors.toList());
final GetSchemaResponse resp = new GetSchemaResponse();
resp.type("schema");
resp.name(schemaName);
resp.datasource(dataSourceName);
resp.tenant(tenantName);
resp.tables(tableLinks);
return resp;
}
示例5: get
import javax.ws.rs.core.UriBuilder; //導入方法依賴的package包/類
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public GetTableResponse get(@PathVariable("tenant") String tenantId,
@PathVariable("dataContext") String dataSourceName, @PathVariable("schema") String schemaId,
@PathVariable("table") String tableId) {
final TenantContext tenantContext = tenantRegistry.getTenantContext(tenantId);
final DataContext dataContext = tenantContext.getDataSourceRegistry().openDataContext(dataSourceName);
final DataContextTraverser traverser = new DataContextTraverser(dataContext);
final Table table = traverser.getTable(schemaId, tableId);
final String tenantName = tenantContext.getTenantName();
final UriBuilder uriBuilder = UriBuilder.fromPath("/{tenant}/{dataContext}/s/{schema}/t/{table}/c/{column}");
final String tableName = table.getName();
final String schemaName = table.getSchema().getName();
final List<GetTableResponseColumns> columnsLinks = table.getColumnNames().stream().map(c -> {
final String uri = uriBuilder.build(tenantName, dataSourceName, schemaName, tableName, c).toString();
return new GetTableResponseColumns().name(c).uri(uri);
}).collect(Collectors.toList());
final GetTableResponse resp = new GetTableResponse();
resp.type("table");
resp.name(tableName);
resp.schema(schemaName);
resp.datasource(dataSourceName);
resp.tenant(tenantName);
resp.columns(columnsLinks);
return resp;
}