Example usage for java.net URI create

List of usage examples for java.net URI create

Introduction

In this page you can find the example usage for java.net URI create.

Prototype

public static URI create(String str) 

Source Link

Document

Creates a URI by parsing the given string.

Usage

From source file:com.msopentech.odatajclient.engine.data.atom.AtomEntry.java

@Override
public void setBaseURI(final String baseURI) {
    this.baseURI = URI.create(baseURI);
}

From source file:net.sf.taverna.t2.activities.spreadsheet.SpreadsheetImportActivityFactory.java

@Override
public URI getActivityType() {
    return URI.create(SpreadsheetImportActivity.URI);
}

From source file:net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLInputSplitterActivityFactory.java

@Override
public URI getActivityType() {
    return URI.create(XMLInputSplitterActivity.URI);
}

From source file:com.ibm.watson.developer_cloud.retrieve_and_rank.v1.utils.HttpSolrClientUtils.java

/**
 * Creates the {@link HttpClient} to use with the Solrj
 *
 * @param url the Solr server url// www .j a  v  a2 s .  com
 * @param username the {@link RetrieveAndRank} service username
 * @param password the {@link RetrieveAndRank} service password
 * @return the {@link HttpClient}
 */
public static HttpClient createHttpClient(String url, String username, String password) {
    URI scopeUri = URI.create(url);

    BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
    credentialsProvider.setCredentials(new AuthScope(scopeUri.getHost(), scopeUri.getPort()),
            new UsernamePasswordCredentials(username, password));

    HttpClientBuilder builder = HttpClientBuilder.create().setMaxConnTotal(128).setMaxConnPerRoute(32)
            .setDefaultRequestConfig(
                    RequestConfig.copy(RequestConfig.DEFAULT).setRedirectsEnabled(true).build())
            .setDefaultCredentialsProvider(credentialsProvider)
            .addInterceptorFirst(new PreemptiveAuthInterceptor());
    return builder.build();
}

From source file:net.ripe.rpki.commons.xml.converters.URIConverter.java

@Override
public Object fromString(String str) {
    if (StringUtils.isEmpty(str)) {
        return null;
    } else {//from   www. j a v  a 2  s. c  o  m
        return URI.create(str);
    }
}

From source file:net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLOutputSplitterActivityFactory.java

@Override
public URI getActivityType() {
    return URI.create(XMLOutputSplitterActivity.URI);
}

From source file:de.otto.jsonhome.controller.HtmlControllerTest.java

@Test
public void testGetRel() throws Exception {
    // given/*from   ww  w . j ava  2s .c o  m*/
    final HtmlController controller = relController(
            ControllerWithRequestMappingAndLinkRelationTypeAtClassLevel.class);
    // when
    final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/rel/foo");
    request.setServerName("rel.example.org");
    request.setScheme("http");
    final ModelAndView resourcesMap = controller.getRelationshipType(request);
    // then
    assertEquals(resourcesMap.getViewName(), "directresource");
    assertNotNull(resourcesMap.getModel().get("resource"));
    @SuppressWarnings("unchecked")
    final DirectLink model = (DirectLink) resourcesMap.getModel().get("resource");
    assertEquals(model.getHref(), URI.create("http://app.example.org/bar"));
}

From source file:com.sap.core.odata.fit.basic.RequestContentTypeTest.java

@Test
public void illegalContentType() throws Exception {
    HttpPost post = new HttpPost(URI.create(getEndpoint().toString() + "Rooms"));
    post.setHeader(HttpHeaders.CONTENT_TYPE, "illegal");
    final HttpResponse response = getHttpClient().execute(post);
    assertEquals(HttpStatusCodes.UNSUPPORTED_MEDIA_TYPE.getStatusCode(),
            response.getStatusLine().getStatusCode());
}

From source file:fr.patouche.soat.google.GoogleApplicationTests.java

@Test
public void everythingIsSecuredByDefault() throws Exception {
    TestRestTemplate restTemplate = new TestRestTemplate();
    ResponseEntity<Void> entity = restTemplate.getForEntity("http://localhost:" + this.port, Void.class);
    assertThat(entity.getStatusCode(), is(HttpStatus.FOUND));
    assertThat(entity.getHeaders().getLocation(),
            is(equalTo(URI.create("http://localhost:" + this.port + "/login"))));
}

From source file:de.tudarmstadt.ukp.dkpro.bigdata.io.hadoop.HdfsResource.java

HdfsResource(String parent, String child, FileSystem fs) {
    this(StringUtils.hasText(child) ? new Path(new Path(URI.create(parent)), new Path(URI.create(child)))
            : new Path(URI.create(parent)), fs);
}