List of usage examples for java.net URI toString
public String toString()
From source file:com.github.woonsanko.katharsis.examples.hippo.katharsis.filter.HstEnabledKatharsisFilter.java
/** * Returns the currently resolved domain by HST host/site mapping. * @return//from ww w . j a va 2s . co m */ @Override public String getResourceDefaultDomain() { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext == null) { // only for debugging purpose... log.warn("HST RequestContext is not available."); return "http://localhost:8080"; } HstLinkCreator linkCreator = HstServices.getComponentManager().getComponent(HstLinkCreator.class.getName()); HstLink link = linkCreator.create("/", requestContext.getResolvedMount().getMount()); URI uri = URI.create(link.toUrlForm(requestContext, true)); return StringUtils.removeEnd(uri.toString(), "/"); }
From source file:com.google.mr4c.hadoop.MR4CGenericOptions.java
public void addFile(URI file, String alias) { m_files.add(file.toString() + "#" + alias); }
From source file:org.everrest.sample.spring.BookService.java
@PUT @Consumes("application/json") public Response put(Book book, @Context UriInfo uriInfo) { String id = bookStorage.putBook(book); URI location = uriInfo.getBaseUriBuilder().path(getClass()).path(id).build(); return Response.created(location).entity(location.toString()).type("text/plain").build(); }
From source file:client.ConfigServerClient.java
/** * Gets the data for a particular host./*from ww w . j av a 2 s. co m*/ * * @param hostname the host to lookup * @return the data for the host */ public F.Promise<HostOutput> getHostData(final String hostname) { final URI uri = uri(String.format("/host/%s", hostname)); return WS.url(uri.toString()).get() .map(wsResponse -> YAML_MAPPER.readValue(wsResponse.getBody(), HostOutput.class)); }
From source file:org.openmhealth.schema.domain.DataFile.java
public DataFile(URI location, JsonNode data) { Matcher matcher = TEST_DATA_URI_PATTERN.matcher(location.toString()); checkArgument(matcher.find(), "The URI '%s' doesn't identify a document containing test data.", location); this.name = matcher.group(5); this.location = location; this.path = matcher.group(0); this.schemaId = new SchemaId(matcher.group(1), matcher.group(2), new SchemaVersion(matcher.group(3))); this.expectedValidationResult = matcher.group(4).equals("shouldPass") ? PASS : FAIL; this.data = data; }
From source file:com.jaspersoft.android.jaspermobile.network.cookie.AppCookieStore.java
@Override public void add(URI uri, HttpCookie cookie) { mStore.add(uri, cookie); mWebViewCookieStore.add(uri.toString(), cookie.toString()); }
From source file:io.wcm.caravan.commons.httpclient.impl.HttpClientFactoryImpl.java
@Override public HttpClient getWs(URI targetUrl, URI wsAddressingToUri) { return getFactoryItem(targetUrl, wsAddressingToUri.toString()).getHttpClient(); }
From source file:de.fuberlin.agcsw.heraclitus.graph.GraphAnalyse.java
public static Graph<JungVertex, JungEdge> mapOntologyToGraphModel(URI physicalURI, URI namespace) { System.out.println("Starting mapping full Ontology to full Graph Model"); Graph<JungVertex, JungEdge> g = new DirectedSparseMultigraph<JungVertex, JungEdge>(); try {//w w w. j av a 2s . co m rep = new SailRepository(new MemoryStore()); rep.initialize(); RepositoryConnection con = rep.getConnection(); ValueFactory f = rep.getValueFactory(); con.add(physicalURI.toURL(), namespace.toString(), RDFFormat.RDFXML, f.createURI("http://graph.com")); // con.getStatements(arg0, arg1, arg2, arg3, arg4) RepositoryResult<Statement> statements = con.getStatements(null, null, null, true); // System.out.println("There are "+statements.asList().size()+" statements in the graph"); while (statements.hasNext()) { Statement st = statements.next(); Resource sub = st.getSubject(); org.openrdf.model.URI pred = st.getPredicate(); Value obj = st.getObject(); System.out.println( "S: " + sub.stringValue() + " P: " + pred.stringValue() + " O: " + obj.stringValue()); // if (pred.stringValue().equals("http://www.w3.org/2000/01/rdf-schema#subClassOf")) { String strSub = sub.stringValue().substring(sub.stringValue().indexOf("#") + 1); String strPred = pred.stringValue().substring(pred.stringValue().indexOf("#") + 1); String strObj = obj.stringValue().substring(obj.stringValue().indexOf("#") + 1); // if (strPred.equals("subClassOf")) { //test of obj is blank node -- continue then // if (strObj.startsWith("node")) continue; //test id Sub Vertex is in graph JungVertex subV = null; JungVertex objV = null; boolean subExists = false; boolean objExists = false; for (JungVertex v : g.getVertices()) { if (v.toString().equals(strSub)) { subExists = true; subV = v; } if (v.toString().equals(strObj)) { objExists = true; objV = v; } } if (!subExists) { subV = new JungVertex(strSub, URI.create(sub.stringValue())); g.addVertex(subV); } if (!objExists) { //findout if obj is literal if (obj instanceof Literal) { objV = new JungVertex(strObj, null); } else objV = new JungVertex(strObj, URI.create(obj.stringValue())); g.addVertex(objV); } // g.getV // // boolean end = false; // Collection<String> edges = g.findEdgeSet(strSub, strObj); // for (String se : edges) { // if (se.equals(strPred)) { // System.out.println("Edge still exists -- dont add it again"); // end = true; // } // } // if (end) continue; JungEdge predV = new JungEdge(strPred); g.addEdge(predV, subV, objV); } // } // Node e1 = m.createNode(strSub,false); // // Node e2 = m.createNode(strObj,(obj instanceof Literal)); // // m.addEdge(new Edge(e1,e2,strPred)); return g; } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RDFParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return g; }
From source file:io.wcm.caravan.commons.httpasyncclient.impl.HttpAsyncClientFactoryImpl.java
@Override public HttpAsyncClient getWs(URI targetUrl, URI wsAddressingToUri) { return getFactoryItem(targetUrl, wsAddressingToUri.toString()).getHttpAsyncClient(); }
From source file:fi.vm.kapa.identification.service.ErrorServiceTest.java
@Test public void testGenerateErrorUrl() { URI errorUri = errorService.generateErrorURI(); assertNotNull(errorUri);/* w w w . jav a2s . co m*/ assertEquals("http://test.disco.page?msg=cancel", errorUri.toString()); }