javax.ws.rs.core.UriBuilder.userInfo()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(108)

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

UriBuilder.userInfo介绍

[英]Set the URI user-info.
[中]设置URI用户信息。

代码示例

代码示例来源:origin: Netflix/eureka

protected EurekaHttpClient getEurekaClientWithBasicAuthentication(String userName, String password) {
  URI serviceURI = UriBuilder.fromUri(getHttpServer().getServiceURI()).userInfo(userName + ':' + password).build();
  return getEurekaHttpClient(serviceURI);
}

代码示例来源:origin: Netflix/eureka

serviceURI = UriBuilder.fromUri(serviceURI).userInfo(userName + ':' + password).build();

代码示例来源:origin: jcabi/jcabi-http

@Override
public RequestURI userInfo(final String info) {
  return new BaseRequest.BaseURI(
    this.owner,
    UriBuilder.fromUri(this.address)
      .userInfo(info)
      .build().toString()
  );
}
@Override

代码示例来源:origin: HuygensING/timbuctoo

public URI fromResourceUri(URI resourceUri) {
 URI baseUri = UriBuilder.fromUri(this.baseUri).build();
 return UriBuilder.fromUri(resourceUri)
          .userInfo(baseUri.getUserInfo())
          .scheme(baseUri.getScheme())
          .host(baseUri.getHost())
          .port(baseUri.getPort())
          .replacePath(baseUri.getPath()).path(resourceUri.getPath())
          .build();
}

代码示例来源:origin: com.netflix.eureka/eureka-test-utils

protected EurekaHttpClient getEurekaClientWithBasicAuthentication(String userName, String password) {
  URI serviceURI = UriBuilder.fromUri(getHttpServer().getServiceURI()).userInfo(userName + ':' + password).build();
  return getEurekaHttpClient(serviceURI);
}

代码示例来源:origin: com.bazaarvoice.emodb/emodb-sor-hadoop

/**
 * Converts a location URI to a data source identifier.
 */
public static String getDataStoreIdentifier(URI location, String apiKey) {
  checkArgument(getLocationType(location) != LocationType.STASH, "Stash locations do not have a data source ID");
  UriBuilder uriBuilder = UriBuilder.fromUri(location)
      .userInfo(apiKey)
      .replacePath(null)
      .replaceQuery(null);
  if (getLocationType(location) == LocationType.EMO_HOST_DISCOVERY) {
    Optional<String> zkConnectionStringOverride = getZkConnectionStringOverride(location);
    if (zkConnectionStringOverride.isPresent()) {
      uriBuilder.queryParam(ZK_CONNECTION_STRING_PARAM, zkConnectionStringOverride.get());
    }
    Optional<List<String>> hosts = getHostOverride(location);
    if (hosts.isPresent()) {
      for (String host : hosts.get()) {
        uriBuilder.queryParam(HOST_PARAM, host);
      }
    }
  }
  return uriBuilder.build().toString();
}

代码示例来源:origin: bazaarvoice/emodb

/**
 * Converts a location URI to a data source identifier.
 */
public static String getDataStoreIdentifier(URI location, String apiKey) {
  checkArgument(getLocationType(location) != LocationType.STASH, "Stash locations do not have a data source ID");
  UriBuilder uriBuilder = UriBuilder.fromUri(location)
      .userInfo(apiKey)
      .replacePath(null)
      .replaceQuery(null);
  if (getLocationType(location) == LocationType.EMO_HOST_DISCOVERY) {
    Optional<String> zkConnectionStringOverride = getZkConnectionStringOverride(location);
    if (zkConnectionStringOverride.isPresent()) {
      uriBuilder.queryParam(ZK_CONNECTION_STRING_PARAM, zkConnectionStringOverride.get());
    }
    Optional<List<String>> hosts = getHostOverride(location);
    if (hosts.isPresent()) {
      for (String host : hosts.get()) {
        uriBuilder.queryParam(HOST_PARAM, host);
      }
    }
  }
  return uriBuilder.build().toString();
}

代码示例来源:origin: opencast/opencast

builder = UriBuilder.fromUri(toolUri).scheme(null).host(null).userInfo(null).port(-1);

代码示例来源:origin: com.netflix.eureka/eureka-test-utils

serviceURI = UriBuilder.fromUri(serviceURI).userInfo(userName + ':' + password).build();

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs

/**
 * @param ref
 * @param b
 * @return
 * @throws IllegalArgumentException
 */
private UriBuilder fillUriBuilder(Reference ref, final UriBuilder b)
    throws IllegalArgumentException {
  b.scheme(ref.getScheme(false));
  b.userInfo(ref.getUserInfo(false));
  b.host(ref.getHostDomain(false));
  b.port(ref.getHostPort());
  b.path(ref.getPath(false));
  b.replaceQuery(ref.getQuery(false));
  b.fragment(ref.getFragment(false));
  return b;
}

相关文章