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

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

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

UriBuilder.fromUri介绍

[英]Create a new instance initialized from an existing URI.
[中]创建一个从现有URI初始化的新实例。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Create new instance using existing Client instance, and a base URI and any parameters
 * 
 */
public PurRepositoryPluginApiRevision( com.sun.jersey.api.client.Client client, URI baseUri ) {
 _client = client;
 _uriBuilder = UriBuilder.fromUri( baseUri );
 _uriBuilder = _uriBuilder.path( "/pur-repository-plugin/api/revision" );
 _templateAndMatrixParameterValues = new HashMap<String, Object>();
}

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

@Override
public String start() {
  final UriBuilder uriBuilder = UriBuilder.fromUri(authorizationUri);
  for (final Map.Entry<String, String> entry : authorizationProperties.entrySet()) {
    uriBuilder.queryParam(entry.getKey(), entry.getValue());
  }
  return uriBuilder.build().toString();
}

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

public static String externalUri( String internalUri, String xForwardedHost, String xForwardedProto )
{
  return externalUri( UriBuilder.fromUri( internalUri ), xForwardedHost, xForwardedProto ).toString();
}

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

private static ThrowingConsumer<HttpServletResponse, IOException> passwordChangeRequired( final String username, final String baseURL )
{
  URI path = UriBuilder.fromUri( baseURL ).path( format( "/user/%s/password", username ) ).build();
  return error( 403,
      map( "errors", singletonList( map(
          "code", Status.Security.Forbidden.code().serialize(),
          "message", "User is required to change their password." ) ), "password_change", path.toString() ) );
}

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

NettyTestContainer(URI baseUri, DeploymentContext deploymentContext) {
  this.baseUri = UriBuilder.fromUri(baseUri).path(deploymentContext.getContextPath()).build();
  this.deploymentContext = deploymentContext;
}

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

UriBuilder.fromUri( firstHostInXForwardedHostHeader ).build();

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

requestURI = UriBuilder.fromUri(requestURI)
      .replacePath(
          requestURIPath
              .substring(0, requestURIPath.lastIndexOf('/') + 1))
      .build();
    ? UriBuilder.fromPath(root).path("/application.wadl/") : UriBuilder.fromPath("./application.wadl/");
final URI rootURI = root != null ? UriBuilder.fromPath(root).build() : null;
  final URI schemaURI = extendedPath.clone().path(path).build();
  final String schemaPath = rootURI != null ? requestURI.relativize(schemaURI).toString() : schemaURI.toString();

代码示例来源:origin: opentripplanner/OpenTripPlanner

private URL getGeocoderURL(String geocoderBaseUrl, String address) throws MalformedURLException {
  UriBuilder builder = UriBuilder.fromUri(geocoderBaseUrl);
  builder.queryParam("address", address);
  URI uri = builder.build();
  return new URL(uri.toString());
}

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

private ExternalTestContainer(final URI baseUri, final DeploymentContext context) {
  final UriBuilder uriBuilder = UriBuilder.fromUri(baseUri).path(context.getContextPath());
  if (context instanceof ServletDeploymentContext) {
    uriBuilder.path(((ServletDeploymentContext) context).getServletPath());
  }
  this.baseUri = uriBuilder.build();
  if (LOGGER.isLoggable(Level.INFO)) {
    LOGGER.info("Creating ExternalTestContainer configured at the base URI " + this.baseUri);
  }
}

代码示例来源:origin: liferay/liferay-portal

public static URI updateWithQueryParameters(
  URI uri, Map<String, String> queryParameters) {
  if ((queryParameters == null) || queryParameters.isEmpty()) {
    return uri;
  }
  for (Map.Entry<String, String> parameter : queryParameters.entrySet()) {
    UriBuilder uriBuilder = UriBuilder.fromUri(uri);
    uri = uriBuilder.replaceQueryParam(
      parameter.getKey(), parameter.getValue()
    ).build();
  }
  return uri;
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Create new instance using existing Client instance, and a base URI and any parameters
 * 
 */
public PurRepositoryPluginApiPurge( com.sun.jersey.api.client.Client client, URI baseUri ) {
 _client = client;
 _uriBuilder = UriBuilder.fromUri( baseUri );
 _uriBuilder = _uriBuilder.path( "/pur-repository-plugin/api/purge" );
 _templateAndMatrixParameterValues = new HashMap<String, Object>();
}

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

requestURI = UriBuilder.fromUri(requestURI)
      .replacePath(
          requestURIPath
              .substring(0, requestURIPath.lastIndexOf('/') + 1))
      .build();
    ? UriBuilder.fromPath(root).path("/application.wadl/") : UriBuilder.fromPath("./application.wadl/");
final URI rootURI = root != null ? UriBuilder.fromPath(root).build() : null;
  final URI schemaURI = extendedPath.clone().path(path).build();
  final String schemaPath = rootURI != null ? requestURI.relativize(schemaURI).toString() : schemaURI.toString();

代码示例来源:origin: opentripplanner/OpenTripPlanner

private URL getGoogleGeocoderUrl(String address) throws IOException {
  UriBuilder uriBuilder = UriBuilder.fromUri("http://maps.google.com/maps/api/geocode/json");
  uriBuilder.queryParam("sensor", false);
  uriBuilder.queryParam("address", address);
  URI uri = uriBuilder.build();
  return new URL(uri.toString());
}

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

private SimpleTestContainer(final URI baseUri, final DeploymentContext context) {
  final URI base = UriBuilder.fromUri(baseUri).path(context.getContextPath()).build();
  if (!"/".equals(base.getRawPath())) {
    throw new TestContainerException(String.format(
        "Cannot deploy on %s. Simple framework container only supports deployment on root path.",
        base.getRawPath()));
  }
  this.baseUri = base;
  if (LOGGER.isLoggable(Level.INFO)) {
    LOGGER.info("Creating SimpleTestContainer configured at the base URI " + this.baseUri);
  }
  this.deploymentContext = context;
}

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

private URI getBaseURI(final URI baseUri) {
  String stagingHostName = AccessController.doPrivileged(PropertiesHelper.getSystemProperty(JERSEY_TEST_HOST));
  if (stagingHostName != null) {
    return UriBuilder.fromUri(baseUri).host(stagingHostName).build();
  }
  return baseUri;
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Create new instance using existing Client instance, and a base URI and any parameters
 * 
 */
public PathIdPurge( com.sun.jersey.api.client.Client client, URI baseUri, String pathid ) {
 _client = client;
 _uriBuilder = UriBuilder.fromUri( baseUri );
 _uriBuilder = _uriBuilder.path( "{pathId : .+}/purge" );
 _templateAndMatrixParameterValues = new HashMap<String, Object>();
 _templateAndMatrixParameterValues.put( "pathId", pathid );
}

代码示例来源:origin: com.sun.jersey/jersey-server

requestURI = UriBuilder.fromUri(requestURI)
      .replacePath(
      requestURIPath
      .substring(0, requestURIPath.lastIndexOf('/') + 1))
      .build();
    ? UriBuilder.fromPath(root).path("/application.wadl/")
    : UriBuilder.fromPath("./application.wadl/");
URI rootURI = root != null ? UriBuilder.fromPath(root).build() : null;
      extendedPath.clone().path(path).build();
  String schemaURIS = schemaURI.toString();
  String requestURIs = requestURI.toString();
      ? requestURI.relativize(schemaURI).toString()
      : schemaURI.toString();

代码示例来源:origin: opentripplanner/OpenTripPlanner

private URL getYahooGeocoderUrl(String address) throws IOException {
  UriBuilder uriBuilder = UriBuilder.fromUri("http://where.yahooapis.com/geocode");
  uriBuilder.queryParam("location", address);
  uriBuilder.queryParam("flags", "J");
  uriBuilder.queryParam("appid", appId);
  if (locale != null) {
    uriBuilder.queryParam("locale", locale);
    uriBuilder.queryParam("gflags", "L");
  }
  URI uri = uriBuilder.build();
  return new URL(uri.toString());
}

代码示例来源:origin: confluentinc/ksql

@GET
 public Response get(@Context final UriInfo uriInfo) {
  final URI uri = UriBuilder.fromUri(uriInfo.getAbsolutePath())
    .path(postFix)
    .build();

  return Response.temporaryRedirect(uri).build();
 }
}

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

/**
   * Gets base {@link URI}.
   *
   * @return base {@link URI}.
   */
  public static URI getBaseURI() {
    return UriBuilder.fromUri("http://localhost/").port(getPort(8080)).build();
  }
}

相关文章