List of usage examples for java.net URI getPath
public String getPath()
From source file:svnserver.ext.web.server.WebServer.java
@NotNull public URI getUrl(@NotNull URI baseUri) { if (config.getBaseUrl() != null) { return URI.create(config.getBaseUrl()).resolve(baseUri.getPath()); }/*from w w w . j a va 2 s. c o m*/ return baseUri; }
From source file:chat.viska.xmpp.Connection.java
/** * Constructs a {@link Connection} with a full server URI. Convenient method * of {@link #Connection(Protocol, String, String, int, String)}. *//*from w ww . j av a 2s . com*/ public Connection(final Protocol protocol, final URI uri) { this(protocol, uri.getScheme(), uri.getHost(), uri.getPort(), uri.getPath()); }
From source file:io.cloudslang.lang.cli.utils.CompilerHelperTest.java
@Test public void testLoadInputsFromFile() throws Exception { Map<String, Serializable> expected = new HashMap<>(); expected.put("host", "localhost"); expected.put("port", "22"); URI inputsFromFile = getClass().getResource("/inputs/inputs.yaml").toURI(); Map<String, ? extends Serializable> result = compilerHelper .loadInputsFromFile(Collections.singletonList(inputsFromFile.getPath())); Assert.assertNotNull(result);//from w w w .j av a 2 s . com Assert.assertEquals(expected, result); }
From source file:uk.ac.ebi.eva.pipeline.jobs.steps.VariantLoaderStep.java
@Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { ObjectMap variantOptions = jobOptions.getVariantOptions(); ObjectMap pipelineOptions = jobOptions.getPipelineOptions(); VariantStorageManager variantStorageManager = StorageManagerFactory.getVariantStorageManager();// TODO add mongo URI outdirUri = URLHelper.createUri(pipelineOptions.getString("output.dir")); URI nextFileUri = URLHelper.createUri(pipelineOptions.getString("input.vcf")); // URI pedigreeUri = pipelineOptions.getString("input.pedigree") != null ? createUri(pipelineOptions.getString("input.pedigree")) : null; Path output = Paths.get(outdirUri.getPath()); Path input = Paths.get(nextFileUri.getPath()); Path outputVariantJsonFile = output.resolve( input.getFileName().toString() + ".variants.json" + pipelineOptions.getString("compressExtension")); // outputFileJsonFile = output.resolve(input.getFileName().toString() + ".file.json" + config.compressExtension); URI transformedVariantsUri = outdirUri.resolve(outputVariantJsonFile.getFileName().toString()); logger.info("-- PreLoad variants -- {}", nextFileUri); variantStorageManager.preLoad(transformedVariantsUri, outdirUri, variantOptions); logger.info("-- Load variants -- {}", nextFileUri); variantStorageManager.load(transformedVariantsUri, variantOptions); // logger.info("-- PostLoad variants -- {}", nextFileUri); // variantStorageManager.postLoad(transformedVariantsUri, outdirUri, variantOptions); return RepeatStatus.FINISHED; }
From source file:eu.esdihumboldt.hale.io.groovy.ui.snippets.SnippetConfigurationPage.java
@Override protected void onShowPage(boolean firstShow) { super.onShowPage(firstShow); if (firstShow) { // determine default for identifier from file name URI loc = null; try {/*from w w w . j a v a 2 s.co m*/ loc = getWizard().getProvider().getSource().getLocation(); } catch (NullPointerException e) { // ignore } if (loc != null) { String baseName = FilenameUtils.getBaseName(loc.getPath()); if (baseName != null && !baseName.isEmpty()) { baseName = baseName.replaceAll("[^\\w]", "_"); identifierText.setText(baseName); updateState(); } } } }
From source file:hsyndicate.hadoop.dfs.HSyndicateDFS.java
private SyndicateFSPath createSyndicateFSPath(URI uri) throws IOException { return createSyndicateFSPath(uri.getPath()); }
From source file:io.cloudslang.lang.tools.build.tester.parser.TestCasesYamlParserTest.java
@Test public void parseSystemPropertiesFile() throws Exception { URI filePath = getClass().getResource("/content/base/properties.prop.sl").toURI(); SlangSource source = SlangSource.fromFile(filePath); Set<SystemProperty> props = new HashSet<>(); when(slang.loadSystemProperties(eq(source))).thenReturn(props); parser.parseProperties(filePath.getPath()); verify(slang).loadSystemProperties(eq(source)); }
From source file:eu.stratosphere.test.util.AbstractTestBase.java
public File asFile(String path) { try {//from w w w . j ava2 s . c o m URI uri = new URI(path); if (uri.getScheme().equals("file")) { return new File(uri.getPath()); } else { throw new IllegalArgumentException("This path does not denote a local file."); } } catch (URISyntaxException e) { throw new IllegalArgumentException("This path does not describe a valid local file URI."); } }
From source file:io.cloudslang.lang.tools.build.tester.parser.TestCasesYamlParserTest.java
@Test public void parseSystemPropertiesFileInvalidExtension() throws Exception { URI filePath = getClass().getResource("/content/base/print_text.sl").toURI(); exception.expect(RuntimeException.class); exception.expectMessage("print_text.sl"); exception.expectMessage("extension"); exception.expectMessage("prop.sl"); parser.parseProperties(filePath.getPath()); }
From source file:com.jaspersoft.jasperserver.war.OlapGetChart.java
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * @param request servlet request/* w ww .j a v a 2 s . com*/ * @param response servlet response */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String filename = request.getParameter("filename"); logger.debug("GetChart called: filename=" + filename); if (filename == null) { throw new ServletException("Parameter 'filename' must be supplied"); } // Replace ".." with "" // This is to prevent access to the rest of the file system filename = searchReplace(filename, "..", ""); // Check the file exists File file = new File(System.getProperty("java.io.tmpdir"), filename); if (!file.exists()) { logger.error("File '" + file.getAbsolutePath() + "' does not exist"); URL url = this.getClass().getResource(fileNotFound); URI uri; try { uri = new URI(url.toString()); } catch (URISyntaxException e) { throw new ServletException(e); } file = new File(uri.getPath()); } else { // Serve it up sendTempFile(file, response); } return; }