/** * 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; }
/** * 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; }
/** * 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(); }
/** * 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; } }
/** * 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; }
/** * 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); }
/** * 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); }
/** * 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); }