Example #1
0
 /**
  * Gets the redirect.
  *
  * @param htoken the htoken
  * @return the redirect
  */
 public static Pair<String, String> getRedirect(final String htoken) {
   final String token = HistoryUtils.undoHashbang(htoken);
   final String[] splited = splitRedirect(token);
   if (hasRedirect(token, splited)) {
     return Pair.create(splited[0], splited[1].replaceAll("\\)$", ""));
   }
   return null;
 }
Example #2
0
 /**
  * Checks for redirect.
  *
  * @param htoken the htoken
  * @return true, if successful
  */
 public static boolean hasRedirect(final String htoken) {
   final String token = HistoryUtils.undoHashbang(htoken);
   final String[] splited = splitRedirect(token);
   if (hasRedirect(token, splited)) {
     return true;
   }
   return false;
 }
Example #3
0
 /**
  * Checks if is group token.
  *
  * @param htoken the htoken
  * @return true, if is group token
  */
 public static boolean isGroupToken(final String htoken) {
   final String token = HistoryUtils.undoHashbang(htoken);
   return token != null
       && !isWaveToken(token)
       && !hasRedirect(token)
       && !reservedWordsRegistry.contains(token)
       && !new StateToken(token).hasNothing();
 }
Example #4
0
 /**
  * Checks if is wave token.
  *
  * @param htoken the htoken
  * @return true, if is wave token
  */
 public static boolean isWaveToken(final String htoken) {
   final String token = HistoryUtils.undoHashbang(htoken);
   assert encoder != null;
   try {
     return token == null ? false : encoder.decodeWaveRefFromPath(token) != null;
   } catch (final InvalidWaveRefException e) {
     return false;
   }
 }
Example #5
0
 /**
  * Checks for redirect.
  *
  * @param htoken the htoken
  * @param splited the splited
  * @return true, if successful
  */
 private static boolean hasRedirect(final String htoken, final String[] splited) {
   final String token = HistoryUtils.undoHashbang(htoken);
   return token.endsWith(")") && splited.length == 2;
 }
Example #6
0
 /**
  * Split redirect.
  *
  * @param htoken the htoken
  * @return the string[]
  */
 private static String[] splitRedirect(final String htoken) {
   final String token = HistoryUtils.undoHashbang(htoken);
   return token.split("\\(", 2);
 }
Example #7
0
 /**
  * Checks if is inbox token.
  *
  * @param htoken the htoken
  * @return true, if is inbox token
  */
 public static boolean isInboxToken(final String htoken) {
   final String token = HistoryUtils.undoHashbang(htoken);
   return SiteTokens.WAVE_INBOX.equals(token);
 }
Example #8
0
 /**
  * Checks if is home token.
  *
  * @param htoken the htoken
  * @return true, if is home token
  */
 public static boolean isHomeToken(final String htoken) {
   final String token = HistoryUtils.undoHashbang(htoken);
   return SiteTokens.HOME.equals(token);
 }