public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
     throws Exception {
   JodaTimeContext context = new JodaTimeContext();
   context.setTimeZone(getTimeZone(request));
   JodaTimeContextHolder.setJodaTimeContext(context);
   return true;
 }
Ejemplo n.º 2
0
 private void setTimeZoneForDateTimeFilter() {
   JodaTimeContext jodaTimeContext = getJodaTimeContext();
   // check JodaTimeContext first and use it if set
   if (jodaTimeContext != null)
     engine.getConfiguration().setTimezone(jodaTimeContext.getTimeZone().toTimeZone());
   else { // try attrib param next
     String timeZone = (String) getAttributesMap().get(PARAM_TIMEZONE);
     if (timeZone != null) {
       engine.getConfiguration().setTimezone(TimeZone.getTimeZone(timeZone));
       JodaTimeContext context = JodaTimeContextHolder.getJodaTimeContext();
       if (context == null) context = new JodaTimeContext();
       context.setTimeZone(DateTimeZone.forID(timeZone));
       JodaTimeContextHolder.setJodaTimeContext(context);
     }
   }
 }