org.eclipse.emf.common.util.URI.port()方法的使用及代码示例

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

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

URI.port介绍

[英]If this is a hierarchical URI with an authority component that has a port portion, returns it; null otherwise.
[中]如果这是一个具有权限组件的层次URI,该组件具有端口部分,则返回该URI;null否则。

代码示例

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.common

@Override
public String port()
{
 return uri.port();
}

代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-core

@Override
public String port() {
  return internalUri.port();
}

代码示例来源:origin: atlanmod/NeoEMF

@Override
public String port() {
  return base.port();
}

代码示例来源:origin: atlanmod/NeoEMF

/**
 * Creates a {@link URL} from the given {@code uri}.
 *
 * @param uri the URI to convert
 *
 * @return a new URL
 *
 * @throws MalformedURLException if an error occurs during the {@link URL} creation
 */
@Nonnull
// TODO Add HTTPS support
private static URL uriToUrl(URI uri) throws MalformedURLException {
  final String protocol = "http";
  final String delimiter = "_";
  int port = isNull(uri.port()) ? -1 : Integer.parseInt(uri.port());
  String path = uri.segmentsList().stream()
      .map(s -> s.replaceAll("-", delimiter))
      .collect(Collectors.joining(delimiter, "/", Strings.EMPTY));
  return new URL(protocol, uri.host(), port, path);
}

代码示例来源:origin: atlanmod/NeoEMF

@Test
void testCreateRemoteUriWithIPAddr() throws UnknownHostException {
  final URI uri = factory.createRemoteUri(InetAddress.getByName("192.168.0.1"), 1234, "test");
  assertThat(uri.isHierarchical()).isTrue();
  assertThat(uri.scheme()).isEqualTo(SCHEME);
  assertThat(uri.host()).isEqualTo("192.168.0.1");
  assertThat(uri.port()).isEqualTo(Integer.toString(1234));
  assertThat(uri.segments()).containsExactly("test");
}

代码示例来源:origin: atlanmod/NeoEMF

@Test
void testCreateRemoteUriWithStringLocal() {
  final URI uri = factory.createRemoteUri("localhost", 1234, "test");
  assertThat(uri.isHierarchical()).isTrue();
  assertThat(uri.scheme()).isEqualTo(SCHEME);
  assertThat(uri.host()).isEqualTo("127.0.0.1");
  assertThat(uri.port()).isEqualTo(Integer.toString(1234));
  assertThat(uri.segments()).containsExactly("test");
}

代码示例来源:origin: atlanmod/NeoEMF

@Test
void testCreateRemoteUriWithStringAddr() {
  final URI uri = factory.createRemoteUri("192.168.0.1", 1234, "test");
  assertThat(uri.isHierarchical()).isTrue();
  assertThat(uri.scheme()).isEqualTo(SCHEME);
  assertThat(uri.host()).isEqualTo("192.168.0.1");
  assertThat(uri.port()).isEqualTo(Integer.toString(1234));
  assertThat(uri.segments()).containsExactly("test");
}

代码示例来源:origin: org.geoserver/gs-wfs

request.setBaseUrl(uri.scheme() + "://" + uri.host() + ":" + uri.port() + uri.path());

相关文章