Esempio n. 1
0
  /**
   * Gets tag title from the specified URI.
   *
   * @param requestURI the specified request URI
   * @return tag title
   */
  private static String getTagTitle(final String requestURI) {
    final String path = requestURI.substring((Latkes.getContextPath() + "/tags/").length());

    if (path.contains("/")) {
      return path.substring(0, path.indexOf("/"));
    } else {
      return path.substring(0);
    }
  }
Esempio n. 2
0
  /**
   * Gets the request page number from the specified request URI and tag title.
   *
   * @param requestURI the specified request URI
   * @param tagTitle the specified tag title
   * @return page number, returns {@code -1} if the specified request URI can not convert to an
   *     number
   */
  private static int getCurrentPageNum(final String requestURI, final String tagTitle) {
    if (Strings.isEmptyOrNull(tagTitle)) {
      return -1;
    }

    final String pageNumString =
        requestURI.substring((Latkes.getContextPath() + "/tags/" + tagTitle + "/").length());

    return Requests.getCurrentPageNum(pageNumString);
  }