com.google.gdata.client.Query.getQueryUri()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(102)

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

Query.getQueryUri介绍

[英]Returns the relative query URI that represents only the query parameters without any components related to the target feed. Subclasses of the Query class may override this method to add additional URI path elements or HTTP query parameters to represent service-specific parameters.
[中]返回相对查询URI,该URI仅表示查询参数,不包含与目标提要相关的任何组件。Query类的子类可以重写此方法,以添加额外的URI路径元素或HTTP查询参数来表示特定于服务的参数。

代码示例

代码示例来源:origin: com.google.gdata/gdata-core-1.0

/**
 * Returns the Query URL that encapsulates the current state of this
 * query object.
 *
 * @return URL that represents the query against the target feed.
 */
public URL getUrl() {
 try {
  String queryUri = getQueryUri().toString();
  if (queryUri.length() == 0) {
   return feedUrl;
  }
  // Build the full query URL.  An earlier implementation of this
  // was done using URI.resolve(), but there are issues if both the
  // base and relative URIs contain path components (the last path
  // element on the base will be removed).
  String feedRoot = feedUrl.toString();
  StringBuilder urlBuf = new StringBuilder(feedRoot);
  if (!feedRoot.endsWith("/") && !queryUri.startsWith("?")) {
   urlBuf.append('/');
  }
  urlBuf.append(queryUri);
  return new URL(urlBuf.toString());
 // Since we are combining a valid URL and a valid URI,
 // any exception thrown below is not a user error.
 } catch (MalformedURLException mue) {
  throw new IllegalStateException("Unable to create query URL", mue);
 }
}

代码示例来源:origin: com.mulesoft.google/google-api-gdata

/**
 * Returns the Query URL that encapsulates the current state of this
 * query object.
 *
 * @return URL that represents the query against the target feed.
 */
public URL getUrl() {
 try {
  String queryUri = getQueryUri().toString();
  if (queryUri.length() == 0) {
   return feedUrl;
  }
  // Build the full query URL.  An earlier implementation of this
  // was done using URI.resolve(), but there are issues if both the
  // base and relative URIs contain path components (the last path
  // element on the base will be removed).
  String feedRoot = feedUrl.toString();
  StringBuilder urlBuf = new StringBuilder(feedRoot);
  if (!feedRoot.endsWith("/") && !queryUri.startsWith("?")) {
   urlBuf.append('/');
  }
  urlBuf.append(queryUri);
  return new URL(urlBuf.toString());
 // Since we are combining a valid URL and a valid URI,
 // any exception thrown below is not a user error.
 } catch (MalformedURLException mue) {
  throw new IllegalStateException("Unable to create query URL", mue);
 }
}

代码示例来源:origin: com.google.gdata/gdata-java-client

/**
 * Returns the Query URL that encapsulates the current state of this
 * query object.
 *
 * @return URL that represents the query against the target feed.
 */
public URL getUrl() {
 try {
  String queryUri = getQueryUri().toString();
  if (queryUri.length() == 0) {
   return feedUrl;
  }
  // Build the full query URL.  An earlier implementation of this
  // was done using URI.resolve(), but there are issues if both the
  // base and relative URIs contain path components (the last path
  // element on the base will be removed).
  String feedRoot = feedUrl.toString();
  StringBuilder urlBuf = new StringBuilder(feedRoot);
  if (!feedRoot.endsWith("/") && !queryUri.startsWith("?")) {
   urlBuf.append('/');
  }
  urlBuf.append(queryUri);
  return new URL(urlBuf.toString());
 // Since we are combining a valid URL and a valid URI,
 // any exception thrown below is not a user error.
 } catch (MalformedURLException mue) {
  throw new IllegalStateException("Unable to create query URL", mue);
 }
}

相关文章