Package java.util.regex

Examples of java.util.regex.Matcher.appendReplacement()


         {
            value = Encode.encodeNonCodes(value);
         }
         // if there is a $ then we must backslash it or it will screw up regex group substitution
         value = value.replace("$", "\\$");
         matcher.appendReplacement(buffer, value);
      }
      matcher.appendTail(buffer);
      return buffer;
   }
View Full Code Here


            }
            else
            {
               value = Encode.encodePathSaveEncodings(value);
            }
            matcher.appendReplacement(buffer, value);
         }
         else
         {
            throw new IllegalArgumentException("path param " + param + " has not been provided by the parameter map");
         }
View Full Code Here

            }
            else
            {
               value = Encode.encodeQueryParamSaveEncodings(value);
            }
            matcher.appendReplacement(buffer, value);
         }
         else
         {
            throw new IllegalArgumentException("path param " + param + " has not been provided by the parameter map");
         }
View Full Code Here

      while (matcher.find())
      {
         foundParam = true;
         String group = matcher.group();
         pathParams.add(PathHelper.recoverEnclosedCurlyBraces(group));
         matcher.appendReplacement(newSegment, "_resteasy_uri_parameter");
      }
      matcher.appendTail(newSegment);
      path = newSegment.toString();

      // Find last path segment
View Full Code Here

         matcher = PARAM_REPLACEMENT.matcher(path);
         newSegment = new StringBuffer();
         int i = 0;
         while (matcher.find())
         {
            matcher.appendReplacement(newSegment, pathParams.get(i++));
         }
         matcher.appendTail(newSegment);
         path = newSegment.toString();
      }
      return this;
View Full Code Here

            String repl = replacer.getReplacement(pattern, m, replacementPattern);
            if (repl != null) {
              if (log.isDebugEnabled())
                log.debug("Found replacement, appending '" + repl + "'");
                if(encoder == null) {
                    m.appendReplacement(work, Util.escapeForRegexpReplacement(repl));
                }
                else {
                    m.appendReplacement(work, encoder.encode(Util.escapeForRegexpReplacement(repl)));                   
                }
            }
View Full Code Here

                log.debug("Found replacement, appending '" + repl + "'");
                if(encoder == null) {
                    m.appendReplacement(work, Util.escapeForRegexpReplacement(repl));
                }
                else {
                    m.appendReplacement(work, encoder.encode(Util.escapeForRegexpReplacement(repl)));                   
                }
            }
        }
        if (log.isDebugEnabled())
          log.debug("Processed matches, appending replacement.");
View Full Code Here

        if(m.group(4) != null) url = m.group(4);
        if(m.group(6) != null) url = m.group(6);
        if(m.group(8) != null) url = m.group(8);
        if(m.group(10) != null) url = m.group(10);
        if (url.startsWith("data:") || url.startsWith("#")) {
            m.appendReplacement(result, init + url);

        } else if (url.startsWith("http")) {
          // absoulte url of form href="http://domain.com/path"
          if (sb.getConfig("proxyURL.rewriteURLs", "all").equals("domainlist")) {
            if (sb.crawlStacker.urlInAcceptedDomain(new DigestURI(url)) != null) {
View Full Code Here

            if (sb.crawlStacker.urlInAcceptedDomain(new DigestURI(url)) != null) {
              continue;
            }
          }

            m.appendReplacement(result, init + "/proxy.html?url=" + url);

        } else if (url.startsWith("/")) {
          // absolute path of form href="/absolute/path/to/linked/page"
            m.appendReplacement(result, init + "/proxy.html?url=http://" + proxyurl.getHost() + url);
View Full Code Here

            m.appendReplacement(result, init + "/proxy.html?url=" + url);

        } else if (url.startsWith("/")) {
          // absolute path of form href="/absolute/path/to/linked/page"
            m.appendReplacement(result, init + "/proxy.html?url=http://" + proxyurl.getHost() + url);

        } else {
          // relative path of form href="relative/path"
          MultiProtocolURI target = new MultiProtocolURI(proxyurl.getHost() + directory + "/" + url);
            m.appendReplacement(result, init + "/proxy.html?url=" + target.toString());
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.