Package java.net

Examples of java.net.URI.normalize()


        }
        URI tmpURI = null;
        URL tmpURL = url;
        try {
            tmpURI = new URI(url.toString());
            tmpURL = tmpURI.normalize().toURL();
        } catch (URISyntaxException use) {
            logger.error("url-normalization-failure", url.toString(), use);
        }
       
        return tmpURL;
View Full Code Here


        try {
            URI uri = new URI(arg);
            if ("file".equalsIgnoreCase(uri.getScheme())) {
                if (!uri.isOpaque()) {
                    return uri.normalize().toString();
                }
                return new File("").toURI().resolve(uri.getPath()).toString();
            } else {
                return normalize(arg);
            }
View Full Code Here

      log.error("Return_to url is not in the correct syntax", e);
      throw new RelyingPartyException("Return_to url is not in the correct syntax", e);
    }

    try {
      url = uri.normalize().toURL();
    } catch (MalformedURLException e) {
      log.error("Return_to url is malformed", e);
      throw new RelyingPartyException("Return_to url is malformed", e);
    }
View Full Code Here

            log.error("Invalid OpenID URL :" + openID, e);
            throw new IdentityException("Invalid OpenID URL");
        }

        try {
            url = uri.normalize().toURL();
            if (url.getQuery() != null || url.getRef() != null) {
                log.error("Invalid user name for OpenID :" + openID);
                throw new IdentityException("Invalid user name for OpenID");
            }
        } catch (MalformedURLException e) {
View Full Code Here

            log.error("Invalid relying party URL :" + rpUrl, e);
            throw new IdentityException("Invalid relying party URL");
        }

        try {
            url = uri.normalize().toURL();
            url = new URL(url.getProtocol().toLowerCase(), url.getHost().toLowerCase(), url
                    .getPort(), url.getPath());
            return url.toString();
        } catch (MalformedURLException e) {
            log.error("Malformed relying party URL :" + rpUrl, e);
View Full Code Here

    URI uri = null;
    try
    {
            returnURL = new URL(url);
      uri = new URI(url);
      uri = uri.normalize();
      returnURL =  new URL(uri.toString());
    }

    catch (Exception mue)
    {
View Full Code Here

      if (j > i)
        i = j;
      try
      {
        uri = new URI(baseURI.substring(0, i + 1) + url);
        uri = uri.normalize();
        returnURL = uri.toURL();
      }
      catch (Exception e)
      {
        return new URL(baseURI.substring(0, i + 1) + url);
View Full Code Here

     
      file = file.replace('\\','/');
      if (!file.startsWith("/")) file = "/" + file;
     
      URI uri = new URI("file", null, file, null, null);
      uri = uri.normalize();

      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "--- doFtp : uri = " + uri);
     
      FtpMessage clone = (FtpMessage) msg.clone();
View Full Code Here

                "/a/..b/c", "/a/b..c/d", "", "a", "a/b", "a/b/c", "../", "",
                "..", "../g", "b/c/g", "../c/e", "../c/", };

        for (int i = 0; i < normalizeData.length; i++) {
            URI test = new URI(normalizeData[i]);
            String result = test.normalize().toString();
            assertEquals("Normalized incorrectly, ", normalizeResults[i],
                    result.toString());
        }
    }
View Full Code Here

     * @tests java.net.URI#normalize()
     */
    public void test_normalize2() throws URISyntaxException {
        URI uri1 = null, uri2 = null;
        uri1 = new URI("file:/D:/one/two/../../three");
        uri2 = uri1.normalize();

        assertEquals("Normalized to incorrect URI", "file:/D:/three", uri2
                .toString());
        assertTrue("Resolved URI is not absolute", uri2.isAbsolute());
        assertFalse("Resolved URI is opaque", uri2.isOpaque());
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.