com.ibm.watson.developer_cloud.http.RequestBuilder.get()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中com.ibm.watson.developer_cloud.http.RequestBuilder.get方法的一些代码示例,展示了RequestBuilder.get的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RequestBuilder.get方法的具体详情如下:
包路径:com.ibm.watson.developer_cloud.http.RequestBuilder
类名称:RequestBuilder
方法名:get

RequestBuilder.get介绍

[英]The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.
[中]GET方法意味着检索请求URI标识的任何信息(以实体的形式)。

代码示例

代码示例来源:origin: com.ibm.watson.developer_cloud/retrieve-and-rank

private Request buildGetSizeRequest(String solrClusterId) {
  final String resizePath = createSizePath(solrClusterId);
  final RequestBuilder requestBuilder = RequestBuilder.get(resizePath);
  return requestBuilder.build();
 }
}

代码示例来源:origin: com.ibm.watson.developer_cloud/retrieve-and-rank

/**
 * Retrieves the status of a ranker.
 *
 * @param rankerID the ranker ID
 * @return Ranker object with the status field set
 * @see Ranker
 */
public ServiceCall<Ranker> getRankerStatus(final String rankerID) {
 Validator.isTrue((rankerID != null) && !rankerID.isEmpty(), "rankerId cannot be null or empty");
 final Request request = RequestBuilder.get(String.format(PATH_RANKER, rankerID)).build();
 return createServiceCall(request, ResponseConverterUtils.getObject(Ranker.class));
}

代码示例来源:origin: com.ibm.watson.developer_cloud/retrieve-and-rank

@Override
public ServiceCall<SolrCluster> getSolrCluster(String solrClusterId) {
 Validator.isTrue((solrClusterId != null) && !solrClusterId.isEmpty(), "solrClusterId cannot be null or empty");
 final Request request = RequestBuilder.get(String.format(PATH_GET_SOLR_CLUSTER, solrClusterId)).build();
 return createServiceCall(request, ResponseConverterUtils.getObject(SolrCluster.class));
}

代码示例来源:origin: com.ibm.watson.developer_cloud/retrieve-and-rank

/**
 * Gathers memory and disk usage stats from a Solr cluster.
 *
 * @param solrClusterId the ID of the Solr cluster to gather stats from
 * @return stats about the Solr cluster
 */
public ServiceCall<SolrClusterStats> getSolrClusterStats(String solrClusterId) {
 Validator.isTrue((solrClusterId != null) && !solrClusterId.isEmpty(), "solrClusterId cannot be null or empty");
 final Request request = RequestBuilder.get(String.format(PATH_GET_SOLR_CLUSTER, solrClusterId) + "/stats").build();
 return createServiceCall(request, ResponseConverterUtils.getObject(SolrClusterStats.class));
}

代码示例来源:origin: com.ibm.watson.developer_cloud/retrieve-and-rank

@Override
public ServiceCall<SolrConfigs> getSolrClusterConfigurations(String solrClusterId) {
 Validator.isTrue((solrClusterId != null) && !solrClusterId.isEmpty(), "solrClusterId cannot be null or empty");
 final Request request = RequestBuilder.get(String.format(PATH_SOLR_CLUSTERS_CONFIG, solrClusterId)).build();
 return createServiceCall(request, ResponseConverterUtils.getObject(SolrConfigs.class));
}

代码示例来源:origin: com.ibm.watson.developer_cloud/dialog

/**
 * Gets content for nodes.
 *
 * @param dialogId the dialog identifier
 * @return The {@link DialogContent} for nodes
 */
public ServiceCall<List<DialogContent>> getContent(final String dialogId) {
 Validator.isTrue((dialogId != null) && !dialogId.isEmpty(), "dialogId cannot be null or empty");
 final Request request = RequestBuilder.get(String.format(PATH_DIALOG_CONTENT, dialogId)).build();
 final ResponseConverter<List<DialogContent>> converter =
   ResponseConverterUtils.getGenericObject(listDialogContentType, ITEMS);
 return createServiceCall(request, converter);
}

代码示例来源:origin: watson-developer-cloud/java-sdk

/**
 * Test request with null url.
 */
@Test(expected = IllegalArgumentException.class)
public void testUrlNull() {
 RequestBuilder.get(null);
}

代码示例来源:origin: com.ibm.watson.developer_cloud/retrieve-and-rank

@Override
public ServiceCall<SolrClusters> getSolrClusters() {
 final Request request = RequestBuilder.get(PATH_SOLR_CLUSTERS).build();
 return createServiceCall(request, ResponseConverterUtils.getObject(SolrClusters.class));
}

代码示例来源:origin: com.ibm.watson.developer_cloud/retrieve-and-rank

/**
 * retrieves the list of rankers for the user.
 *
 * @return the rankers
 */
public ServiceCall<Rankers> getRankers() {
 final Request request = RequestBuilder.get(PATH_RANKERS).build();
 return createServiceCall(request, ResponseConverterUtils.getObject(Rankers.class));
}

代码示例来源:origin: com.ibm.watson.developer_cloud/dialog

/**
 * Retrieves the list of Dialogs for the user.
 *
 * @return the {@link Dialog} list
 */
public ServiceCall<List<Dialog>> getDialogs() {
 final Request request = RequestBuilder.get(PATH_DIALOGS).build();
 ResponseConverter<List<Dialog>> converter = ResponseConverterUtils.getGenericObject(listDialogType, DIALOGS);
 return createServiceCall(request, converter);
}

代码示例来源:origin: com.ibm.watson.developer_cloud/retrieve-and-rank

@Override
public ServiceCall<InputStream> getSolrClusterConfiguration(String solrClusterId, String configName) {
 Validator.isTrue((solrClusterId != null) && !solrClusterId.isEmpty(), "solrClusterId cannot be null or empty");
 Validator.isTrue((configName != null) && !configName.isEmpty(), "configName cannot be null or empty");
 final String configPath = createConfigPath(solrClusterId, configName);
 final RequestBuilder requestBuider =
   RequestBuilder.get(configPath).header(HttpHeaders.ACCEPT, HttpMediaType.APPLICATION_ZIP);
 return createServiceCall(requestBuider.build(), ResponseConverterUtils.getInputStream());
}

代码示例来源:origin: watson-developer-cloud/java-sdk

/**
 * Test get.
 */
@Test
public void testGet() {
 final Request request = RequestBuilder.get(HttpUrl.parse(urlWithQuery)).build();
 assertEquals("GET", request.method());
 assertEquals(urlWithQuery, request.url().toString());
}

代码示例来源:origin: watson-developer-cloud/java-sdk

/**
 * Test requests with special characters in the query string.
 */
@Test
public void testSpecialCharacterQuery() {
 final Request request = RequestBuilder.get(HttpUrl.parse(url)).query("ä&ö", "ö=ü").build();
 assertEquals(url + "?%C3%A4%26%C3%B6=%C3%B6%3D%C3%BC", request.url().toString());
}

代码示例来源:origin: watson-developer-cloud/java-sdk

/**
 * List classifiers.
 *
 * Returns an empty array if no classifiers are available.
 *
 * @param listClassifiersOptions the {@link ListClassifiersOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link ClassifierList}
 */
public ServiceCall<ClassifierList> listClassifiers(ListClassifiersOptions listClassifiersOptions) {
 String[] pathSegments = { "v1/classifiers" };
 RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
 if (listClassifiersOptions != null) {
 }
 return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ClassifierList.class));
}

代码示例来源:origin: watson-developer-cloud/java-sdk

/**
 * Gets the list of submitted batch-processing jobs.
 *
 * Gets the list of batch-processing jobs submitted by users.
 *
 * @param listBatchesOptions the {@link ListBatchesOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link Batches}
 */
public ServiceCall<Batches> listBatches(ListBatchesOptions listBatchesOptions) {
 String[] pathSegments = { "v1/batches" };
 RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
 builder.query(VERSION, versionDate);
 if (listBatchesOptions != null) {
 }
 return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Batches.class));
}

代码示例来源:origin: watson-developer-cloud/java-sdk

public ServiceCall<TestModel> testMethod() {
  RequestBuilder builder = RequestBuilder.get(HttpUrl.parse(getEndPoint() + "/v1/test"));
  return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TestModel.class));
 }
}

代码示例来源:origin: watson-developer-cloud/java-sdk

public ServiceCall<GenericModel> testMethod() {
  RequestBuilder builder = RequestBuilder.get(HttpUrl.parse(getEndPoint() + "/v1/test"));
  return createServiceCall(builder.build(), ResponseConverterUtils.getObject(GenericModel.class));
 }
}

代码示例来源:origin: watson-developer-cloud/java-sdk

public ServiceCall<TestModel> testMethod() {
 RequestBuilder builder = RequestBuilder.get(HttpUrl.parse(getEndPoint() + "/v1/test"));
 return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TestModel.class));
}

代码示例来源:origin: watson-developer-cloud/java-sdk

/**
 * Get environment info.
 *
 * @param getEnvironmentOptions the {@link GetEnvironmentOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link Environment}
 */
public ServiceCall<Environment> getEnvironment(GetEnvironmentOptions getEnvironmentOptions) {
 Validator.notNull(getEnvironmentOptions, "getEnvironmentOptions cannot be null");
 String[] pathSegments = { "v1/environments" };
 String[] pathParameters = { getEnvironmentOptions.environmentId() };
 RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
   pathParameters));
 builder.query(VERSION, versionDate);
 return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Environment.class));
}

代码示例来源:origin: watson-developer-cloud/java-sdk

/**
 * Get collection details.
 *
 * @param getCollectionOptions the {@link GetCollectionOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link Collection}
 */
public ServiceCall<Collection> getCollection(GetCollectionOptions getCollectionOptions) {
 Validator.notNull(getCollectionOptions, "getCollectionOptions cannot be null");
 String[] pathSegments = { "v1/environments", "collections" };
 String[] pathParameters = { getCollectionOptions.environmentId(), getCollectionOptions.collectionId() };
 RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
   pathParameters));
 builder.query(VERSION, versionDate);
 return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Collection.class));
}

相关文章