List of usage examples for java.net URI URI
public URI(String str) throws URISyntaxException
From source file:com.igormaznitsa.mindmap.model.ModelUtilsTest.java
@Test public void testExtractQueryParameters() throws Exception { final Properties properties = ModelUtils .extractQueryPropertiesFromURI(new URI("file://hello?some=test&other=&misc=%26ffsdsd&h=1")); assertEquals(4, properties.size());/*from www. j av a 2 s .co m*/ assertEquals("test", properties.get("some")); assertEquals("", properties.get("other")); assertEquals("&ffsdsd", properties.get("misc")); assertEquals("1", properties.get("h")); }
From source file:org.jtalks.tests.jcommune.mail.pochta.PochtaClient.java
/** * Gets list of messages metadata/*from w w w.ja v a2 s . c o m*/ * * @return the list of messages metadata * @throws CouldNotGetMessagesException */ public static String getMessages() throws CouldNotGetMessagesException { RestTemplate client = new RestTemplate(); try { return client.getForObject(new URI(mailtrapMessagesUri()), String.class); } catch (Exception e) { throw new CouldNotGetMessagesException(e); } }
From source file:es.mityc.firmaJava.libreria.xades.elementos.EncodingEnum.java
public static EncodingEnum getEncoding(String uri) { try {/*from ww w .j a va 2s. c o m*/ URI temp = new URI(uri); if (temp.equals(DER_ENCODED.uri)) return DER_ENCODED; else if (temp.equals(BER_ENCODED.uri)) return BER_ENCODED; else if (temp.equals(CER_ENCODED.uri)) return CER_ENCODED; else if (temp.equals(PER_ENCODED.uri)) return PER_ENCODED; else if (temp.equals(XER_ENCODED.uri)) return XER_ENCODED; } catch (URISyntaxException ex) { if (logger.isDebugEnabled()) logger.debug("Encoding indicado no es una URI", ex); return null; } return null; }
From source file:com.vmware.identity.openidconnect.client.Issuer.java
Issuer(String value) { Validate.notEmpty(value, "value"); try {//from w ww . j av a 2 s . c o m this.uri = new URI(value); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }
From source file:edu.unc.lib.dl.util.JRDFGraphUtil.java
public static String getRelatedLiteralObject(Graph graph, PID pid, URI predicate) { String result = null;/* ww w . ja va2 s. c o m*/ ClosableIterator<Triple> tripleIter = null; try { URIReference subject = graph.getElementFactory().createResource(new URI("info:fedora/" + pid.getPid())); URIReference pred = graph.getElementFactory().createResource(predicate); Triple findTop = graph.getTripleFactory().createTriple(subject, pred, ANY_OBJECT_NODE); tripleIter = graph.find(findTop); if (tripleIter.hasNext()) { Triple t = tripleIter.next(); Literal n = (Literal) t.getObject(); result = n.getLexicalForm(); } } catch (GraphException e) { log.error("programmer error: ", e); throw new Error(e); } catch (TripleFactoryException e) { log.error("programmer error: ", e); throw new Error(e); } catch (GraphElementFactoryException e) { log.error("programmer error: ", e); throw new Error(e); } catch (URISyntaxException e) { log.error("programmer error: ", e); throw new Error(e); } finally { if (tripleIter != null) tripleIter.close(); } return result; }
From source file:ca.sqlpower.dao.session.URIConverter.java
@Override public URI convertToComplexType(String convertFrom) throws ConversionException { try {/*from w w w . j ava 2 s . c o m*/ return new URI(convertFrom); } catch (URISyntaxException e) { throw new ConversionException(e); } }
From source file:com.github.tomakehurst.wiremock.common.UniqueFilenameGenerator.java
public static String generateIdFromUrl(final String prefix, final String id, final String url) { URIBuilder urlbuild = null;/*from www . j a v a 2 s .c om*/ try { urlbuild = new URIBuilder(url); urlbuild = urlbuild.removeQuery(); return getRandomId(prefix, id, new URI(urlbuild.toString())); } catch (URISyntaxException e) { e.printStackTrace(); } return null; }
From source file:kuona.processor.JenkinsProcessor.java
public JenkinsProcessor(BuildServerSpec spec) { try {/*from w ww. j a v a2 s. co m*/ final URI uri = new URI(spec.getUrl()); final Project project = new Project(uri); this.client = new JenkinsLocalClient(project, new JenkinsHttpClient(project, uri, spec.getUsername(), spec.getPassword())); } catch (URISyntaxException e) { throw new RuntimeException(e); } }
From source file:org.openscore.content.httpclient.build.RequestBuilderTest.java
@Test(expected = IllegalArgumentException.class) public void testNoMethod() throws URISyntaxException { new org.openscore.content.httpclient.build.RequestBuilder().setUri(new URI("/")).build(); }