List of usage examples for java.net URI getPort
public int getPort()
From source file:com._4dconcept.springframework.data.marklogic.config.AbstractMarklogicConfiguration.java
@Bean public MarklogicFactoryBean marklogicContentSource() { URI marklogicUri = getMarklogicUri(); LOGGER.info("Init marklogic connexion at {}:{}", marklogicUri.getHost(), marklogicUri.getPort()); MarklogicFactoryBean marklogicFactoryBean = new MarklogicFactoryBean(); marklogicFactoryBean.setUri(marklogicUri); return marklogicFactoryBean; }
From source file:org.bedework.synch.cnctrs.file.FileConnectorInstance.java
@Override public URI getUri() throws SynchException { try {/*from w w w .j a v a 2 s .c o m*/ //Get yesterdays date final LocalDate yesterday = LocalDate.now().minus(1, ChronoUnit.DAYS); final String yesterdayStr = yesterday.format(DateTimeFormatter.ISO_LOCAL_DATE); final URI infoUri = new URI(info.getUri()); return new URIBuilder().setScheme(infoUri.getScheme()).setHost(infoUri.getHost()) .setPort(infoUri.getPort()).setPath(infoUri.getPath()).build(); } catch (final SynchException se) { throw se; } catch (final Throwable t) { throw new SynchException(t); } }
From source file:com.beyondj.gateway.handlers.tcp.TcpGatewayHandler.java
/** * Creates a new client for the given URL and handler *///from ww w .j av a 2 s .c o m protected NetClient createClient(NetSocket socket, URI url, Handler<AsyncResult<NetSocket>> handler) throws MalformedURLException { NetClient client = vertx.createNetClient(); int port = url.getPort(); String host = url.getHost(); LOG.info("Connecting " + socket.remoteAddress() + " to host " + host + " port " + port + " protocol " + protocol); return client.connect(port, host, handler); }
From source file:com.collective.celos.ci.deploy.WorkflowFilesDeployer.java
URI getTargetJsFileUri(URI uri) throws URISyntaxException { String path = uri.getPath() + File.separator + config.getWorkflowName() + ".js"; return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), path, uri.getQuery(), uri.getFragment());/*from ww w .j a v a2s .c o m*/ }
From source file:lumbermill.aws.kcl.internal.KinesisConsumerBootstrap.java
public KinesisConsumerBootstrap(KinesisClientLibConfiguration kinesisCfg, UnitOfWorkListener unitOfWorkListener, ExceptionStrategy exceptionStrategy, Metrics metricsCallback, boolean dry) { this.kinesisCfg = kinesisCfg; this.unitOfWorkListener = unitOfWorkListener; this.exceptionStrategy = exceptionStrategy; this.metricsCallback = metricsCallback; this.dry = dry; String httpsProxy = System.getenv("https_proxy"); if (StringUtils.isNotEmpty(httpsProxy)) { URI proxy = URI.create(httpsProxy); kinesisCfg.getKinesisClientConfiguration().setProxyHost(proxy.getHost()); kinesisCfg.getKinesisClientConfiguration().setProxyPort(proxy.getPort()); kinesisCfg.getDynamoDBClientConfiguration().setProxyHost(proxy.getHost()); kinesisCfg.getDynamoDBClientConfiguration().setProxyPort(proxy.getPort()); kinesisCfg.getCloudWatchClientConfiguration().setProxyHost(proxy.getHost()); kinesisCfg.getCloudWatchClientConfiguration().setProxyPort(proxy.getPort()); }/*from w w w . j a v a 2 s . c o m*/ }
From source file:com.cloudera.livy.client.http.LivyConnection.java
LivyConnection(URI uri, final HttpConf config) { HttpClientContext ctx = HttpClientContext.create(); int port = uri.getPort() > 0 ? uri.getPort() : 8998; String path = uri.getPath() != null ? uri.getPath() : ""; this.uriRoot = path + "/clients"; RequestConfig reqConfig = new RequestConfig() { @Override/*from w w w .j a v a 2 s .com*/ public int getConnectTimeout() { return (int) config.getTimeAsMs(CONNETION_TIMEOUT); } @Override public int getSocketTimeout() { return (int) config.getTimeAsMs(SOCKET_TIMEOUT); } }; HttpClientBuilder builder = HttpClientBuilder.create().disableAutomaticRetries().evictExpiredConnections() .evictIdleConnections(config.getTimeAsMs(CONNECTION_IDLE_TIMEOUT), TimeUnit.MILLISECONDS) .setConnectionManager(new BasicHttpClientConnectionManager()) .setConnectionReuseStrategy(new DefaultConnectionReuseStrategy()).setDefaultRequestConfig(reqConfig) .setMaxConnTotal(1).setUserAgent("livy-client-http"); this.server = uri; this.client = builder.build(); this.mapper = new ObjectMapper(); }
From source file:bibibi.configs.ProductionProfile.java
@Bean public BasicDataSource dataSource() throws URISyntaxException { URI dbUri = new URI(System.getenv("DATABASE_URL")); String username = dbUri.getUserInfo().split(":")[0]; String password = dbUri.getUserInfo().split(":")[1]; String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + ':' + dbUri.getPort() + dbUri.getPath(); BasicDataSource basicDataSource = new BasicDataSource(); basicDataSource.setUrl(dbUrl);// w w w . j a v a 2 s .com basicDataSource.setUsername(username); basicDataSource.setPassword(password); return basicDataSource; }
From source file:org.robertburrelldonkin.template4couchdb.rest.HttpClientRestClientTest.java
@Test public void testGetUrl() throws Exception { subject.get(URL, mapper);/*from w ww . ja v a2s. c o m*/ ArgumentCaptor<HttpGet> argument = ArgumentCaptor.forClass(HttpGet.class); verify(client).execute(argument.capture(), eq(handler)); URI uri = argument.getValue().getURI(); assertThat(PORT, is(uri.getPort())); assertThat(HOST, is(uri.getHost())); assertThat(PROTOCOL, is(uri.getScheme())); assertThat(PATH, is(uri.getPath())); }
From source file:org.robertburrelldonkin.template4couchdb.rest.HttpClientRestClientTest.java
@Test public void testPostUrl() throws Exception { ArgumentCaptor<HttpPost> argument = ArgumentCaptor.forClass(HttpPost.class); this.subject.post(URL, documentMarshaller, document, responseUnmarshaller); verify(client).execute(argument.capture(), eq(handler)); URI uri = argument.getValue().getURI(); assertThat(PORT, is(uri.getPort())); assertThat(HOST, is(uri.getHost())); assertThat(PROTOCOL, is(uri.getScheme())); assertThat(PATH, is(uri.getPath())); }