Package java.net

Examples of java.net.URI.toASCIIString()


        gr.setExplicitCount(group.getExplicitResources().size());
        gr.setImplicitCount(group.getImplicitResources().size());
        UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("/group/{id}");
        URI uri = uriBuilder.build(group.getId());
        Link link = new Link("edit",uri.toASCIIString());
        gr.getLinks().add(link);
        gr.getLinks().add(getLinkToGroup(group,uriInfo, "self"));

        uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("/group/{id}/metricDefinitions");
View Full Code Here


        gr.getLinks().add(getLinkToGroup(group,uriInfo, "self"));

        uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("/group/{id}/metricDefinitions");
        uri = uriBuilder.build(group.getId());
        link = new Link("metricDefinitions",uri.toASCIIString());
        gr.getLinks().add(link);

        gr.getLinks().add(createUILink(uriInfo,UILinkTemplate.GROUP,group.getId()));

        return gr;
View Full Code Here

        // create new uri with the parameters
        URI out = URISupport.createRemainingURI(new URI(uri), map);
        assertNotNull(out);
        assertEquals("http://localhost:23271/myapp/mytest?foo=abc+def&bar=123%2C456&name=S%C3%B8ren", out.toString());
        assertEquals("http://localhost:23271/myapp/mytest?foo=abc+def&bar=123%2C456&name=S%C3%B8ren", out.toASCIIString());
    }

}
View Full Code Here

        ProxyUriUtils.getUriFromAMUrl(trackingUriWithoutScheme);
      URI proxyUri = ProxyUriUtils.getUriFromAMUrl(proxy);
      URI result = ProxyUriUtils.getProxyUri(trackingUri, proxyUri,
          applicationAttemptId.getApplicationId());
      //We need to strip off the scheme to have it match what was there before
      return result.toASCIIString().substring(HttpConfig.getSchemePrefix().length());
    } catch (URISyntaxException e) {
      LOG.warn("Could not proxify "+trackingUriWithoutScheme,e);
      return trackingUriWithoutScheme;
    } finally {
      this.readLock.unlock();
View Full Code Here

      String proxy = YarnConfiguration.getProxyHostAndPort(conf);
      URI proxyUri = ProxyUriUtils.getUriFromAMUrl(proxy);
      URI result = ProxyUriUtils.getProxyUri(trackingUri, proxyUri,
          applicationAttemptId.getApplicationId());
      //We need to strip off the scheme to have it match what was there before
      return result.toASCIIString().substring(7);
    } catch (URISyntaxException e) {
      LOG.warn("Could not proxify "+trackingUriWithoutScheme,e);
      return trackingUriWithoutScheme;
    } finally {
      this.readLock.unlock();
View Full Code Here

                    null, null);
            if (uri.getQuery() == null && uri.getFragment() == null) {
                return ref;
            }
            StringBuilder normalized = new StringBuilder(
                    ref.toASCIIString());
            if (uri.getQuery() != null) {
                // query string passed through unchanged
                normalized.append('?').append(uri.getRawQuery());
            }
            if (uri.getFragment() != null) {
View Full Code Here

    }

    public String canonicalizeUri(String uri) {
        try {
            URI normalized = URIUtils.resolve(BASE_URI, uri);
            URL u = new URL(normalized.toASCIIString());
            String protocol = u.getProtocol();
            String hostname = u.getHost();
            int port = canonicalizePort(u.getPort(), protocol);
            String path = u.getPath();
            String query = u.getQuery();
View Full Code Here

        PackageRelationshipCollection sheetRels = pkg.getPartsByName(Pattern.compile("/xl/worksheets/sheet1.xml")).get(0).getRelationships();
        assertEquals(3, sheetRels.size());
        PackageRelationship rId1 = sheetRels.getRelationshipByID("rId1");
        assertEquals(TargetMode.EXTERNAL, rId1.getTargetMode());
        URI targetUri = rId1.getTargetURI();
        assertEquals("mailto:nobody@nowhere.uk%C2%A0", targetUri.toASCIIString());
        assertEquals("nobody@nowhere.uk\u00A0", targetUri.getSchemeSpecificPart());

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        pkg.save(out);
        out.close();
View Full Code Here

        sheetRels = pkg.getPartsByName(Pattern.compile("/xl/worksheets/sheet1.xml")).get(0).getRelationships();
        assertEquals(3, sheetRels.size());
        rId1 = sheetRels.getRelationshipByID("rId1");
        assertEquals(TargetMode.EXTERNAL, rId1.getTargetMode());
        targetUri = rId1.getTargetURI();
        assertEquals("mailto:nobody@nowhere.uk%C2%A0", targetUri.toASCIIString());
        assertEquals("nobody@nowhere.uk\u00A0", targetUri.getSchemeSpecificPart());
    }
   
    public void testEntitiesInRels_56164() throws Exception {
        InputStream is = OpenXML4JTestDataSamples.openSampleStream("PackageRelsHasEntities.ooxml");
View Full Code Here

   private static String encodeSegment(final String segment)
   {
      try
      {
         final URI uri = new URI("http", "localhost", "/" + segment, null);
         return uri.toASCIIString().substring(17);
      }
      catch (URISyntaxException e)
      {
         throw new IllegalArgumentException(e);
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.