org.asynchttpclient.uri.Uri.getUserInfo()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(136)

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

Uri.getUserInfo介绍

暂无

代码示例

代码示例来源:origin: AsyncHttpClient/async-http-client

private static void assertUriEquals(Uri uri, URI javaUri) {
 assertEquals(uri.getScheme(), javaUri.getScheme());
 assertEquals(uri.getUserInfo(), javaUri.getUserInfo());
 assertEquals(uri.getHost(), javaUri.getHost());
 assertEquals(uri.getPort(), javaUri.getPort());
 assertEquals(uri.getPath(), javaUri.getPath());
 assertEquals(uri.getQuery(), javaUri.getQuery());
}

代码示例来源:origin: AsyncHttpClient/async-http-client

private boolean overrideWithContext(Uri context) {
 boolean isRelative = false;
 // use context only if schemes match
 if (context != null && (scheme == null || scheme.equalsIgnoreCase(context.getScheme()))) {
  // see RFC2396 5.2.3
  String contextPath = context.getPath();
  if (isNonEmpty(contextPath) && contextPath.charAt(0) == '/') {
   scheme = null;
  }
  if (scheme == null) {
   scheme = context.getScheme();
   userInfo = context.getUserInfo();
   host = context.getHost();
   port = context.getPort();
   path = contextPath;
   isRelative = true;
  }
 }
 return isRelative;
}

代码示例来源:origin: AsyncHttpClient/async-http-client

public Uri encode(Uri uri, List<Param> queryParams) {
 String newPath = encodePath(uri.getPath());
 String newQuery = encodeQuery(uri.getQuery(), queryParams);
 return new Uri(uri.getScheme(),
     uri.getUserInfo(),
     uri.getHost(),
     uri.getPort(),
     newPath,
     newQuery,
     uri.getFragment());
}

代码示例来源:origin: org.asynchttpclient/async-http-client-api

private boolean overrideWithContext(Uri context, String originalUrl) {
  boolean isRelative = false;
  // only use context if the schemes match
  if (context != null && (scheme == null || scheme.equalsIgnoreCase(context.getScheme()))) {
    // see RFC2396 5.2.3
    String contextPath = context.getPath();
    if (isNotEmpty(contextPath) && contextPath.charAt(0) == '/')
     scheme = null;
    if (scheme == null) {
      scheme = context.getScheme();
      userInfo = context.getUserInfo();
      host = context.getHost();
      port = context.getPort();
      path = contextPath;
      isRelative = true;
    }
  }
  return isRelative;
}

代码示例来源:origin: com.tomitribe.tribestream/tribestream-container

public APIConnectionRequestBuilder appendPath(final String path) {
  this.uri = new Uri(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), path, uri.getQuery());
  return this;
}

代码示例来源:origin: org.asynchttpclient/async-http-client-api

public Uri encode(Uri uri, List<Param> queryParams) {
  String newPath = encodePath(uri.getPath());
  String newQuery = encodeQuery(uri.getQuery(), queryParams);
  return new Uri(uri.getScheme(),//
      uri.getUserInfo(),//
      uri.getHost(),//
      uri.getPort(),//
      newPath,//
      newQuery);
}

代码示例来源:origin: com.tomitribe.tribestream/tribestream-container

/**
 * The APIConnectionRequestBuilder Uri is mutated here with the selected Host to execute the Request and then the
 * Request to be called is created.
 *
 * Ideally, we should create a new APIConnectionRequestBuilder so we keep the original version sent by the client.
 * On the other hand is interesting that if we mutate the client original object, then the client has access to
 * everything that was changed, like the actual host used by the Load Balancer, how many retries were required to
 * execute the request and so on. So for now, we keep it mutable.
 *
 * @param requestBuilder the Request to execute with the API Connection information.
 * @param hostUri        the Uri with the Host to execute the Request.
 * @return a Request with the Uri rewritten to the Host where the Request is going to be sent.
 */
Request rewriteHost(final APIConnectionRequestBuilder requestBuilder, final Uri hostUri) {
  final Uri finalUri = new Uri(hostUri.getScheme(),
      hostUri.getUserInfo(),
      hostUri.getHost(),
      hostUri.getPort(),
      requestBuilder.getUri().getPath(),
      requestBuilder.getUri().getQuery());
  requestBuilder.setUri(finalUri);
  return requestBuilder.build();
}

相关文章