List of usage examples for java.net URI create
public static URI create(String str)
From source file:de.otto.jsonhome.generator.SpringJsonHomeGenerator.java
@Value("${jsonhome.relationTypeBaseUri}") public void setRelationTypeBaseUri(final String relationTypeBaseUri) { this.relationTypeBaseUri = URI.create(relationTypeBaseUri); }
From source file:com.googlecode.jsonschema2pojo.ContentResolverTest.java
@Test public void httpLinkIsResolvedToContent() { URI httpUri = URI.create("http://json-schema.org/address"); JsonNode uriContent = resolver.resolve(httpUri); assertThat(uriContent.path("description").asText().length(), is(greaterThan(0))); }
From source file:it.reply.orchestrator.validator.DeploymentRequestValidator.java
@Override public void validate(Object target, Errors errors) { if (target == null) { errors.reject("request.null", "Deployment request is null"); return;//from w w w .ja v a 2 s . c o m } DeploymentRequest deploymentRequest = (DeploymentRequest) target; String callbackUrl = deploymentRequest.getCallback(); if (callbackUrl != null) { if (Strings.nullToEmpty(callbackUrl).trim().isEmpty()) { errors.rejectValue("callback", "callback.blank", "Callback URL is blank"); } else { try { URI.create(callbackUrl).toURL(); } catch (Exception ex) { errors.rejectValue("callback", "callback.malformed", "Callback URL is malformed"); } } } }
From source file:net.hamnaberg.rest.URIListHandler.java
public List<URI> handle(Payload payload) { List<URI> uris = new ArrayList<URI>(); InputStream stream = payload.getInputStream(); try {/*from ww w .j a va2 s. c o m*/ String value = IOUtils.toString(stream); String[] list = value.split("\r\n"); for (String uri : list) { if (uri.charAt(0) == '#') { continue; } uris.add(URI.create(uri)); } } catch (IOException e) { throw new RuntimeException(e); } finally { IOUtils.closeQuietly(stream); } return uris; }
From source file:top.zhacker.ms.reactor.spring.function.Client.java
public void printAllPeople() { URI uri = URI.create(String.format("http://%s:%d/person", Server.HOST, Server.PORT)); ClientRequest request = ClientRequest.method(HttpMethod.GET, uri).build(); Flux<Person> people = exchange.exchange(request).flatMapMany(response -> response.bodyToFlux(Person.class)); Mono<List<Person>> peopleList = people.collectList(); System.out.println(peopleList.block()); }
From source file:com.netflix.spinnaker.kork.jedis.JedisPoolFactory.java
public Pool<Jedis> build(String name, JedisDriverProperties properties) { if (properties.connection == null || "".equals(properties.connection)) { throw new MissingRequiredConfiguration("Jedis client must have a connection defined"); }/* ww w . jav a 2 s .c o m*/ URI redisConnection = URI.create(properties.connection); String host = redisConnection.getHost(); int port = redisConnection.getPort() == -1 ? Protocol.DEFAULT_PORT : redisConnection.getPort(); int database = parseDatabase(redisConnection.getPath()); String password = parsePassword(redisConnection.getUserInfo()); GenericObjectPoolConfig objectPoolConfig = properties.poolConfig; boolean isSSL = redisConnection.getScheme().equals("rediss"); return new InstrumentedJedisPool(registry, // Pool name should always be "null", as setting this is incompat with some SaaS Redis offerings new JedisPool(objectPoolConfig, host, port, properties.timeoutMs, password, database, null, isSSL), name); }
From source file:onl.area51.httpd.action.Actions.java
/** * Register resource handlers for the graphic error handlers * * @param builder//from ww w.java 2 s. co m */ static void registerErrorHandlers(HttpServerBuilder builder) { String base = "/META-INF/errorimages"; URI uri404 = URI.create("/404.png"); URI uri500 = URI.create("/500.png"); builder.registerHandler("/.404.png", HttpRequestHandlerBuilder.create().method("GET") .add(r -> renderResource(Actions.class, r, uri404, base)).end()) .registerHandler("/.500.png", HttpRequestHandlerBuilder.create().method("GET") .add(r -> renderResource(Actions.class, r, uri500, base)).end()) .getGlobalHandlerBuilder() //.log() .method("GET").add(Actions.notFoundAction()).end(); }
From source file:com.appdynamics.cloudfoundry.appdservicebroker.catalog.CatalogFactory.java
@Bean //Catalog catalog(@Value("${serviceBroker.serviceId}") String serviceId, // @Value("${serviceBroker.planId}") String planId) throws ParseException{ Catalog catalog() throws ParseException { // @formatter:off return new Catalog().service().id(UUIDGenerator.generateServiceID()).name("appdynamics") .description("See How Your Apps Are Performing").bindable(true) .tags("appdynamics", "apm", "mobile real-user monitoring", "browser real-user monitoring", "database monitoring", "server monitoring", "application analytics") .metadata().displayName("AppDynamics") .imageUrl(URI.create("http://pbs.twimg.com/profile_images/618576522677350400/jfkiwN8N_normal.png")) .longDescription(//from www .j av a 2 s . co m "AppDynamics - One platform for unified monitoring, devops collaboration, and application analytics.") .providerDisplayName("AppDynamics Inc.") .documentationUrl(URI.create("https://docs.appdynamics.com")) .supportUrl(URI.create("http://www.appdynamics.com/support/")).and() .addAllPlans(System.getenv("APPD_PLANS")).and(); // @formatter:on }
From source file:com.citruspay.mobile.payment.oauth2.OAuth2Client.java
public OAuth2Token getToken(Map<String, String> params) throws ProtocolException, OAuth2Exception { JSONObject json = null;/*w w w. j ava 2s.c o m*/ try { json = rest.post(URI.create("token"), Collections.<Header>emptyList(), buildRequest(params)); } catch (RESTException rx) { throw factory.create(rx); } return OAuth2Token.create(json); }
From source file:com.github.mike10004.pac4j.oauth.googleappsdomainclient.GoogleAppsDomainApi20Test.java
@Test public void testGetAuthorizationUrl() throws Exception { System.out.println("test getAuthorizationUrl"); String clientId = "someRandomChars.apps.googleusercontent.com"; String clientSecret = "someMoreRandomness"; String callbackUri = "https://app.example.com/oauth/callback"; String scope = PROFILE_SCOPE + ' ' + EMAIL_SCOPE; OutputStream stream = null;/*from ww w .ja v a 2 s . c o m*/ String domain = "example.com"; OAuthConfig config = new GoogleAppsDomainOAuthConfig(clientId, clientSecret, callbackUri, SignatureType.Header, scope, stream, domain); GoogleAppsDomainApi20 api = new GoogleAppsDomainApi20(); String authorizationUrl = api.getAuthorizationUrl(config); URI uri = URI.create(authorizationUrl); System.out.println("authorization URL = " + authorizationUrl); List<NameValuePair> queryParts = URLEncodedUtils.parse(uri, Charsets.UTF_8.name()); assertParameterValue(queryParts, "hd", domain); assertParameterValue(queryParts, "scope", scope); assertParameterValue(queryParts, "redirect_uri", callbackUri); assertParameterValue(queryParts, "client_id", clientId); }