Package java.net

Examples of java.net.URI.toASCIIString()


   public static String path(CharSequence s)
   {
      try
      {
         final URI uri = new URI("http", "0.0.0.0", "/" + s, null);
         return uri.toASCIIString().substring(15);
      }
      catch (URISyntaxException e)
      {
         throw new IllegalArgumentException(e);
      }
View Full Code Here


         public String transpose(Rewrite event, EvaluationContext context, String value)
         {
            try
            {
               final URI uri = new URI("http", "localhost", "/" + value, null);
               return uri.toASCIIString().substring(17);
            }
            catch (URISyntaxException e)
            {
               throw new IllegalArgumentException(e);
            }
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

      URI uri = new URI(sb.toString());
     
      if(!noRelative)
        uri = strippedBaseURI.relativize(uri);
      if(logMINOR)
        Logger.minor(this, "Returning "+uri.toASCIIString()+" from "+path+" from baseURI="+baseURI+" stripped base uri="+strippedBaseURI.toString());
      return uri.toASCIIString();
    } catch (URISyntaxException e) {
      Logger.error(this, "Could not parse own URI: path="+path+", typeOverride="+typeOverride+", frag="+u.getFragment()+" : "+e, e);
      String p = path;
      if(typeOverride != null)
View Full Code Here

     
      if(!noRelative)
        uri = strippedBaseURI.relativize(uri);
      if(logMINOR)
        Logger.minor(this, "Returning "+uri.toASCIIString()+" from "+path+" from baseURI="+baseURI+" stripped base uri="+strippedBaseURI.toString());
      return uri.toASCIIString();
    } catch (URISyntaxException e) {
      Logger.error(this, "Could not parse own URI: path="+path+", typeOverride="+typeOverride+", frag="+u.getFragment()+" : "+e, e);
      String p = path;
      if(typeOverride != null)
        p += "?type="+typeOverride;
View Full Code Here

      if(path.startsWith(PLUGINS_PREFIX)) {
        String after = path.substring(PLUGINS_PREFIX.length());
        if(after.indexOf("../") > -1)
          throw new CommentException(l10n("invalidFormURIAttemptToEscape"));
        if(after.matches("[A-Za-z0-9\\.]+"))
          return uri.toASCIIString();
      }
    } catch (URISyntaxException e) {
      throw new CommentException(l10n("couldNotParseFormURIWithError", "error", e.getLocalizedMessage()));
    }
    // Otherwise disallow.
View Full Code Here

   private 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

    protected HttpRequestBase createMethod(Exchange exchange) throws Exception {
        // creating the url to use takes 2-steps
        String url = HttpHelper.createURL(exchange, getEndpoint());
        URI uri = HttpHelper.createURI(exchange, url, getEndpoint());
        // get the url from the uri
        url = uri.toASCIIString();

        // execute any custom url rewrite
        String rewriteUrl = HttpHelper.urlRewrite(exchange, url, getEndpoint(), this);
        if (rewriteUrl != null) {
            // update url and query string from the rewritten url
View Full Code Here

        for (Person userEntity : allUsers) {
            UriBuilder ub = uriInfo.getAbsolutePathBuilder();
            URI userUri = ub.
                    path(userEntity.getUserName()).
                    build();
            uriArray.put(userUri.toASCIIString());
        }
        return uriArray;

  }
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(HttpConfig.getSchemePrefix().length());
    } catch (URISyntaxException e) {
      LOG.warn("Could not proxify "+trackingUriWithoutScheme,e);
      return trackingUriWithoutScheme;
    } finally {
      this.readLock.unlock();
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.