Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #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();
 }
Beispiel #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;
   }
 }
Beispiel #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;
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }