List of usage examples for java.net URI create
public static URI create(String str)
From source file:com.spoiledmilk.ibikecph.login.HTTPDeleteWithBody.java
public HTTPDeleteWithBody(final String uri) { super(); setURI(URI.create(uri)); }
From source file:org.keycloak.authz.server.uma.config.Configuration.java
public static final Configuration fromDefault(String authzServerUri, String realm, URI authorizationEndpoint, URI tokenEndpoint, String publicKeyPem) { Configuration configuration = new Configuration(); configuration.setVersion(Version.CURRENT); if (authzServerUri.endsWith("/")) { authzServerUri = authzServerUri.substring(0, authzServerUri.lastIndexOf("/")); }//ww w .j av a2 s. c om configuration.setServerUrl(URI.create(authzServerUri)); configuration.setIssuer(URI.create(authzServerUri + "/realms/" + realm + "/authz")); configuration.setRealm(realm); configuration.setAuthorizationEndpoint(authorizationEndpoint); configuration.setRptEndpoint(URI.create(authzServerUri + "/realms/" + realm + "/authz/authorize")); configuration.setTokenEndpoint(tokenEndpoint); configuration.setResourceSetRegistrationEndpoint( URI.create(authzServerUri + "/realms/" + realm + "/authz/resource_set")); configuration.setRealmPublicKey(publicKeyPem); return configuration; }
From source file:at.ac.univie.isc.asio.FlockIntegrationSuite.java
@BeforeClass public static void start() { final String[] args = new String[] { "--asio.metadata-repository=" + IntegrationTest.atos.address() }; application.profile("flock-test").run(args); IntegrationTest.configure().baseService(URI.create("http://localhost:" + application.getPort() + "/")) .auth(AuthMechanism.uri().overrideCredentialDelegationHeader(HttpHeaders.AUTHORIZATION)) .rootCredentials("root", "change").timeoutInSeconds(10).defaults().schema("public") .role(Role.NONE.name()); IntegrationTest.deploy("public", ByteSource.wrap(Payload.encodeUtf8("{\"identifier\":\"urn:asio:dataset:integration\"}")), MediaType.APPLICATION_JSON_VALUE); IntegrationTest.warmup();// ww w . j a v a 2 s .c o m }
From source file:com.splunk.shuttl.testutil.TUtilsFunctional.java
/** * @param hadoopPort2/*from www .j a va2 s. co m*/ * @param hadoopHost2 * @return Hadoop {@link FileSystem} configured with shuttl's default host and * port values. */ public static FileSystem getHadoopFileSystem(String hadoopHost, String hadoopPort) { try { return FileSystem.get(URI.create("hdfs://" + hadoopHost + ":" + hadoopPort), new Configuration()); } catch (IOException e) { e.printStackTrace(); TUtilsTestNG.failForException("Couldn't get Hadoop file system.", e); return null; } }
From source file:com.spotify.docker.client.UnixConnectionSocketFactory.java
public static URI sanitizeUri(final URI uri) { if (uri.getScheme().equals("unix")) { return URI.create("unix://localhost:80"); } else {//from w ww . j ava 2s . com return uri; } }
From source file:Main.java
/** * Resolves a reference starting with a query string. * * @param baseURI the base URI/* w ww. j a va 2 s. c o m*/ * @param reference the URI reference starting with a query string * @return the resulting URI */ private static URI resolveReferenceStartingWithQueryString(final URI baseURI, final URI reference) { String baseUri = baseURI.toString(); baseUri = baseUri.indexOf('?') > -1 ? baseUri.substring(0, baseUri.indexOf('?')) : baseUri; return URI.create(baseUri + reference.toString()); }
From source file:com.wudaosoft.net.httpclient.ParameterRequestBuilder.java
public static HttpUriRequest build(RequestBuilder builder) { final HttpRequestBase result; URI uriNotNull = builder.getUri() != null ? builder.getUri() : URI.create("/"); Charset charset = builder.getCharset(); charset = charset != null ? charset : HTTP.DEF_CONTENT_CHARSET; String method = builder.getMethod(); List<NameValuePair> parameters = builder.getParameters(); HttpEntity entityCopy = builder.getEntity(); if (parameters != null && !parameters.isEmpty()) { if (entityCopy == null && (HttpPost.METHOD_NAME.equalsIgnoreCase(method) || HttpPut.METHOD_NAME.equalsIgnoreCase(method) || HttpPatch.METHOD_NAME.equalsIgnoreCase(method))) { entityCopy = new UrlEncodedFormEntity(parameters, charset); } else {/*from w w w . ja va 2 s .c o m*/ try { uriNotNull = new URIBuilder(uriNotNull).setCharset(charset).addParameters(parameters).build(); } catch (final URISyntaxException ex) { // should never happen } } } if (entityCopy == null) { result = new InternalRequest(method); } else { final InternalEntityEclosingRequest request = new InternalEntityEclosingRequest(method); request.setEntity(entityCopy); result = request; } result.setProtocolVersion(builder.getVersion()); result.setURI(uriNotNull); // if (builder.headergroup != null) { // result.setHeaders(builder.headergroup.getAllHeaders()); // } result.setConfig(builder.getConfig()); return result; }
From source file:edu.stanford.junction.director.JAVADirector.java
public static void main(String[] argv) { ActivityScript script = new ActivityScript(); script.setActivityID(JunctionMaker.DIRECTOR_ACTIVITY); //script.addRolePlatform("director", "java", null); //script.addRolePlatform("director","web", null); ////from ww w. java 2s.c o m script.setFriendlyName("Activity Director"); // TODO: These should be in a "carrier" field // ( carrier; implementation; provider; ... ) script.setSessionID(DIRECTOR_SESSION); JunctionActor director = new JAVADirector(); try { Junction jx = mMaker.newJunction(URI.create("junction://prpl.stanford.edu/jxservice"), director); System.out.println("Launched director on " + jx.getInvitationURI()); synchronized (director) { try { director.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } catch (JunctionException e) { e.printStackTrace(System.err); } }
From source file:com.ajah.http.Http.java
private static String get(final String url) throws IOException, HttpException { URI uri;/*from w w w .ja va2 s.com*/ try { uri = URI.create(url); } catch (final IllegalArgumentException e) { log.warning("Illegal URI [" + url + "] - " + e.getMessage()); throw new BadRequestException(e); } return get(uri); }
From source file:com.gopivotal.cloudfoundry.test.support.util.JdbcUrlNormalizer.java
/** * Normalize a JDBC URL to account for differences in underlying implementations when testing. The normalization * algorithm includes removing the {@literal jdbc} prefix and any query parameters, leaving the core part of the URL * (i.e. scheme, host, port, and path).// ww w. ja va 2 s. c o m * * @param raw the raw URL * * @return a normalized URL */ public static URI normalize(String raw) { String modified = raw; if (modified.startsWith("jdbc:")) { modified = modified.replaceFirst("jdbc:", ""); } if (modified.startsWith("postgres:")) { modified = modified.replaceFirst("postgres:", "postgresql:"); } if (modified.contains("@")) { modified = modified.replaceFirst("/[^/@]*@", "/"); } if (modified.contains("?")) { modified = modified.substring(0, modified.indexOf('?')); } return URI.create(modified); }