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.github.sardine.impl.methods.HttpPropPatch.java

public HttpPropPatch(String url) {
    this(URI.create(url));
}

From source file:com.carl.interesting.StartINGServer.java

/**
 * Starts Jetty HTTP server exposing JAX-RS resources defined in this
 * //from  w w  w  .j a  va  2  s .  c  o  m
 * @param port
 * @return [explain parameter]
 * @return Server [explain return type]
 * @exception throws [exception type] [explain exception]
 * @see [class,class#method,class#member]
 */
public static Server startServer(int port) {
    final ResourceConfig rc = new ResourceConfig().packages("com.carl.interesting");
    try {
        String address = InetAddress.getLocalHost().getHostAddress();
        if (NetworkUtil.isPortUsing(address, port)) {
            return null;
        }
        BASE = "http://" + address;
    } catch (UnknownHostException e) {
        LogUtil.logError(LOG, e);
    }
    // create and start a new instance of Jetty http server
    // exposing the Jersey application at base and port
    return JettyHttpContainerFactory.createServer(URI.create(BASE + ":" + Integer.toString(port)), rc);
}

From source file:com.microsoft.alm.common.utils.UrlHelper.java

public static URI createUri(final String url) {
    return URI.create(getCmdLineFriendlyUrl(url));
}

From source file:com.huguesjohnson.retroleague.util.HttpFetch.java

public static InputStream fetch(String address, int timeout) throws MalformedURLException, IOException {
    HttpGet httpRequest = new HttpGet(URI.create(address));
    HttpClient httpclient = new DefaultHttpClient();
    final HttpParams httpParameters = httpclient.getParams();
    HttpConnectionParams.setConnectionTimeout(httpParameters, timeout);
    HttpConnectionParams.setSoTimeout(httpParameters, timeout);
    HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
    HttpEntity entity = response.getEntity();
    BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
    InputStream instream = bufHttpEntity.getContent();
    return (instream);
}

From source file:com.ge.predix.acs.commons.web.UriTemplateUtils.java

public static boolean isCanonicalMatch(final String uriTemplateDef, final String resourceUri) {
    String canonicalResourceURI = URI.create(resourceUri).normalize().toString();
    UriTemplate uriTemplate = new UriTemplate(appendTrailingSlash(uriTemplateDef));
    return uriTemplate.matches(appendTrailingSlash(canonicalResourceURI));
}

From source file:io.restassured.internal.http.CustomHttpMethod.java

public CustomHttpMethod(String methodName, final String uri) {
    this(methodName, URI.create(uri));
}

From source file:com.github.sardine.impl.methods.HttpPropFind.java

public HttpPropFind(final String uri) {
    this(URI.create(uri));
}

From source file:org.jboss.pnc.auth.keycloakutil.httpcomponents.HttpDelete.java

public HttpDelete(final String uri) {
    super();
    setURI(URI.create(uri));
}

From source file:com.azure.webapi.HttpPatch.java

public HttpPatch(String url) {
    super();
    this.setURI(URI.create(url));
}

From source file:nl.surfnet.sab.SabClientIntegrationTest.java

@Test
@Ignore//w w w .  ja v a  2s .com
public void test() throws IOException {

    UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("x", "x");
    HttpClientTransport transport = new HttpClientTransport(credentials, credentials, URI.create("x"),
            URI.create("y"));
    SabClient sabClient = new SabClient(transport);
    SabRoleHolder roles = sabClient.getRoles("x");
    System.out.println(roles);
}