示例#1
0
 /**
  * Rewrite URL {@code url} in accordance with current replay mode, taking replay context {@code
  * flags} into account.
  *
  * <p>It is important to return the same String object {@code url} if no rewrite is necessary, so
  * that caller can short-circuit to avoid expensive String operations.
  *
  * @param url URL, candidate for rewrite. may contain escaping. must not be {@code null}.
  * @param flags <em>context</em> designator, such as {@code "cs_"}. can be {@code null}.
  * @return rewrittenURL, or {@code url} if no rewrite is necessary. never {@code null}.
  */
 public String contextualizeUrl(final String url, String flags) {
   // if we get an empty string, just return it:
   if (url.length() == 0) {
     return url;
   }
   if (url.startsWith(JAVASCRIPT_PREFIX) || url.startsWith(MAILTO_PREFIX)) {
     return url;
   }
   // XXX duplicated check for MAILTO_PREFIX??
   if (url.startsWith(DATA_PREFIX) || url.startsWith(MAILTO_PREFIX)) {
     return url;
   }
   // first make url into absolute, taking BASE into account.
   // (this also removes escaping: ex. "https:\/\/" -> "https://")
   String absurl = super.contextualizeUrl(url);
   if (!isRewriteSupported(absurl)) {
     return url;
   }
   // XXX do this in getConverter
   if (flags == null) {
     flags = "";
   }
   ResultURIConverter converter = getConverter(flags);
   return converter.makeReplayURI(datespec, absurl);
 }
示例#2
0
 public String makeReplayURI(String datespec, String url) {
   if (url.startsWith(EMAIL_PROTOCOL_PREFIX)) {
     return url;
   }
   if (url.startsWith(JAVASCRIPT_PROTOCOL_PREFIX)) {
     return url;
   }
   return base.makeReplayURI(datespec, url);
 }
示例#3
0
 public String makeReplayURI(String datespec, String url) {
   if (url.startsWith(MMS_PROTOCOL_PREFIX)) {
     url = HTTP_PROTOCOL_PREFIX + url.substring(MMS_PROTOCOL_PREFIX.length());
   }
   return base.makeReplayURI(datespec, url);
 }