コード例 #1
0
  private void initDateVariables(HttpServletRequest request) {
    Locale locale = Localization.getLocale(request);

    News news = getCommand().getNews();
    Date creationTime = news.getCreationTime();
    this.localizedMonth =
        DateUtils.format(creationTime, DateUtils.LONG_MONTH_FORMATS.get(locale), locale);
    this.localizedDay =
        DateUtils.format(creationTime, DateUtils.SHORT_DAY_FORMATS.get(locale), locale);
  }
コード例 #2
0
 /** Composes an absolute URL which holds details about the given {@link News}. */
 public static String getNewsUrl(News news, HttpServletRequest request) {
   return String.format(
       "%s%s#post_%d",
       HttpRequestUtils.getContextHomeDirectory(request), NewsUrlParts.BASE_URL, news.getId());
 }