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


Java UriBuilder.fromPath方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:metamodel-membrane,代码行数:21,代码来源:TenantController.java

示例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")));
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:11,代码来源:ConfigStubRule.java

示例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;
}
 
开发者ID:apache,项目名称:metamodel-membrane,代码行数:36,代码来源:DataSourceController.java

示例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;
}
 
开发者ID:apache,项目名称:metamodel-membrane,代码行数:28,代码来源:SchemaController.java

示例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;
}
 
开发者ID:apache,项目名称:metamodel-membrane,代码行数:32,代码来源:TableController.java


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