List of usage examples for java.net URI create
public static URI create(String str)
From source file:com.bennavetta.appsite.serve.ResourceServlet.java
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { log.info("Handling request {}", req); URI actual = base.relativize(URI.create(req.getRequestURI())); try {/* ww w. j a v a2 s . c o m*/ processor.handle(new RedirectedRequest(actual, new HttpServletReq(req)), new HttpServletResp(resp), req.getInputStream(), resp.getOutputStream()); } catch (Exception e) { log.error("Error handling request", e); resp.sendError(HttpStatus.INTERNAL_SERVER_ERROR.value()); } }
From source file:com.thoughtworks.go.plugin.domain.analytics.AnalyticsData.java
public String getFullViewPath() { if (StringUtils.isBlank(assetRoot)) { return viewPath; }/*from ww w. j ava2s . c om*/ int positionOfQueryParamStart = viewPath.indexOf('?'); String viewPathWithoutQueryParams = positionOfQueryParamStart == -1 ? viewPath : viewPath.substring(0, positionOfQueryParamStart); String queryParams = positionOfQueryParamStart == -1 ? "" : viewPath.substring(positionOfQueryParamStart); return URI .create(FilenameUtils.separatorsToUnix(Paths.get(assetRoot, viewPathWithoutQueryParams).toString()) + queryParams) .normalize().toString(); }
From source file:com.msopentech.odatajclient.engine.data.json.JSONEntry.java
@JsonIgnore @Override//w w w . j ava2 s. c om public URI getBaseURI() { URI baseURI = null; if (metadata != null) { final String metadataURI = getMetadata().toASCIIString(); baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue()))); } return baseURI; }
From source file:de.codecentric.boot.admin.discovery.EurekaServiceInstanceConverter.java
@Override protected URI getHealthUrl(ServiceInstance instance) { Assert.isInstanceOf(EurekaServiceInstance.class, instance, "serviceInstance must be of type EurekaServiceInstance"); InstanceInfo instanceInfo = ((EurekaServiceInstance) instance).getInstanceInfo(); String healthUrl = instanceInfo.getSecureHealthCheckUrl(); if (StringUtils.isEmpty(healthUrl)) { healthUrl = instanceInfo.getHealthCheckUrl(); }//w w w . jav a 2 s . c o m return URI.create(healthUrl); }
From source file:gobblin.admin.AdminWebServerTest.java
@BeforeTest public void startServer() { Properties properties = new Properties(); properties.put(ConfigurationKeys.ADMIN_SERVER_PORT_KEY, this.portNumber); this.server = new AdminWebServer(properties, URI.create("http://foobar:3333")); try {/* w ww. ja v a 2 s . c o m*/ this.server.startUp(); } catch (Exception e) { fail(String.format("Exception starting server: %s", e.toString())); } }
From source file:fr.jetoile.hadoopunit.test.hdfs.HdfsUtils.java
HdfsUtils() { try {/* w ww.ja v a2 s . c o m*/ loadConfig(); } catch (ConfigException e) { System.exit(-1); } org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration(); conf.set("fs.default.name", "hdfs://127.0.0.1:" + configuration.getInt(HadoopUnitConfig.HDFS_NAMENODE_PORT_KEY)); URI uri = URI.create("hdfs://127.0.0.1:" + configuration.getInt(HadoopUnitConfig.HDFS_NAMENODE_PORT_KEY)); try { fileSystem = FileSystem.get(uri, conf); } catch (IOException e) { LOGGER.error("unable to create FileSystem", e); } }
From source file:org.piraso.client.net.HttpPirasoEntryReader.java
public void setUri(String uri) { this.uri = URI.create(uri); targetHost = new HttpHost(this.uri.getHost(), this.uri.getPort(), this.uri.getScheme()); }
From source file:com.datatorrent.demos.mapreduce.MRDebuggerApplication.java
@Override public void populateDAG(DAG dag, Configuration arg1) { String daemonAddress = dag.attrValue(DAG.DAEMON_ADDRESS, null); if (daemonAddress == null || StringUtils.isEmpty(daemonAddress)) { daemonAddress = "10.0.2.15:9790"; }// w ww . j a v a2 s. c om MRJobStatusOperator mrJobOperator = dag.addOperator("mrJobStatusOperator", new MRJobStatusOperator()); URI uri = URI.create("ws://" + daemonAddress + "/pubsub"); LOG.info("WebSocket with daemon at: {}", daemonAddress); PubSubWebSocketInputOperator wsIn = dag.addOperator("mrDebuggerQueryWS", new PubSubWebSocketInputOperator()); wsIn.setUri(uri); wsIn.addTopic("contrib.summit.mrDebugger.mrDebuggerQuery"); dag.addStream("query", wsIn.outputPort, mrJobOperator.input); PubSubWebSocketOutputOperator<Object> wsOut = dag.addOperator("mrDebuggerJobResultWS", new PubSubWebSocketOutputOperator<Object>()); wsOut.setUri(uri); wsOut.setTopic("contrib.summit.mrDebugger.jobResult"); PubSubWebSocketOutputOperator<Object> wsMapOut = dag.addOperator("mrDebuggerMapResultWS", new PubSubWebSocketOutputOperator<Object>()); wsMapOut.setUri(uri); wsMapOut.setTopic("contrib.summit.mrDebugger.mapResult"); PubSubWebSocketOutputOperator<Object> wsReduceOut = dag.addOperator("mrDebuggerReduceResultWS", new PubSubWebSocketOutputOperator<Object>()); wsReduceOut.setUri(uri); wsReduceOut.setTopic("contrib.summit.mrDebugger.reduceResult"); dag.addStream("jobConsoledata", mrJobOperator.output, wsOut.input); dag.addStream("mapConsoledata", mrJobOperator.mapOutput, wsMapOut.input); dag.addStream("reduceConsoledata", mrJobOperator.reduceOutput, wsReduceOut.input); }
From source file:org.apache.taverna.gis.GisActivityFactory.java
@Override public URI getActivityType() { return URI.create(GisActivity.ACTIVITY_TYPE); }
From source file:io.github.swagger2markup.GeneralConverterTest.java
@Test public void testFromHttpURI() throws IOException, URISyntaxException { //Given/* www . j a v a 2s. c om*/ Path outputDirectory = Paths.get("build/test/asciidoc/fromUri"); FileUtils.deleteQuietly(outputDirectory.toFile()); //When Swagger2MarkupConverter.from(URI.create("http://petstore.swagger.io/v2/swagger.json")).build() .toFolder(outputDirectory); //Then String[] files = outputDirectory.toFile().list(); assertThat(files).hasSize(4).containsAll(expectedFiles); }