private Date createDate(final String name) throws ParseException { final String value = parameters.get(name); if (value == null) { return null; } return HttpDateFormat.getPreferredDateFormat().parse(value); }
/** * TODO javadoc. */ public static Date readDate(String date) throws ParseException { return HttpDateFormat.readDate(date); }
/** * Read a date. * * @param date the date as a string. * * @return the date * @throws java.text.ParseException in case the date string cannot be parsed. */ public static Date readDate(final String date) throws ParseException { ParseException pe = null; for (final SimpleDateFormat f : HttpDateFormat.getDateFormats()) { try { Date result = f.parse(date); // parse can change time zone -> set it back to GMT f.setTimeZone(GMT_TIME_ZONE); return result; } catch (final ParseException e) { pe = (pe == null) ? e : pe; } } throw pe; } }
protected void addDateParameter(final StringBuilder sb, final String name, final Date p) { if (p != null) { sb.append("; ").append(name).append("=\"").append(HttpDateFormat.getPreferredDateFormat().format(p)).append("\""); } }
/** * TODO javadoc. */ public static Date readDate(String date) throws ParseException { return HttpDateFormat.readDate(date); }
/** * Read a date. * * @param date the date as a string. * * @return the date * @throws java.text.ParseException in case the date string cannot be parsed. */ public static Date readDate(final String date) throws ParseException { ParseException pe = null; for (final SimpleDateFormat f : HttpDateFormat.getDateFormats()) { try { Date result = f.parse(date); // parse can change time zone -> set it back to GMT f.setTimeZone(GMT_TIME_ZONE); return result; } catch (final ParseException e) { pe = (pe == null) ? e : pe; } } throw pe; } }
@Override public String toString(final Date header) { throwIllegalArgumentExceptionIfNull(header, LocalizationMessages.DATE_IS_NULL()); return HttpDateFormat.getPreferredDateFormat().format(header); }
@Override public T fromString(final String value) { if (value == null) { throw new IllegalArgumentException(LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")); } try { return rawType.cast(HttpDateFormat.readDate(value)); } catch (final ParseException ex) { throw new ExtractorException(ex); } }
/** * Read a date. * * @param date the date as a string. * * @return the date * @throws java.text.ParseException in case the date string cannot be parsed. */ public static Date readDate(final String date) throws ParseException { ParseException pe = null; for (final SimpleDateFormat f : HttpDateFormat.getDateFormats()) { try { Date result = f.parse(date); // parse can change time zone -> set it back to GMT f.setTimeZone(GMT_TIME_ZONE); return result; } catch (final ParseException e) { pe = (pe == null) ? e : pe; } } throw pe; } }
@Override public String toString(final Date header) { throwIllegalArgumentExceptionIfNull(header, LocalizationMessages.DATE_IS_NULL()); return HttpDateFormat.getPreferredDateFormat().format(header); }
@Override public T fromString(final String value) { if (value == null) { throw new IllegalArgumentException(LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")); } try { return rawType.cast(HttpDateFormat.readDate(value)); } catch (final ParseException ex) { throw new ExtractorException(ex); } }
/** * Read a date. * * @param date the date as a string. * * @return the date * @throws java.text.ParseException in case the date string cannot be parsed. */ public static Date readDate(final String date) throws ParseException { ParseException pe = null; for (final SimpleDateFormat f : HttpDateFormat.getDateFormats()) { try { Date result = f.parse(date); // parse can change time zone -> set it back to GMT f.setTimeZone(GMT_TIME_ZONE); return result; } catch (final ParseException e) { pe = (pe == null) ? e : pe; } } throw pe; } }
b.append(HttpDateFormat.getPreferredDateFormat().format(cookie.getExpiry()));
} else if (param.startsWith("expires")) { try { cookie.expiry = HttpDateFormat.readDate(value + ", " + bites[++i]); } catch (ParseException e) { LOGGER.log(Level.FINE, LocalizationMessages.ERROR_NEWCOOKIE_EXPIRES(value), e);
/** * Read a date. * * @param date the date as a string. * * @return the date * @throws java.text.ParseException in case the date string cannot be parsed. */ public static Date readDate(final String date) throws ParseException { ParseException pe = null; for (final SimpleDateFormat f : HttpDateFormat.getDateFormats()) { try { Date result = f.parse(date); // parse can change time zone -> set it back to GMT f.setTimeZone(GMT_TIME_ZONE); return result; } catch (final ParseException e) { pe = (pe == null) ? e : pe; } } throw pe; } }
b.append(HttpDateFormat.getPreferredDateFormat().format(cookie.getExpiry()));
} else if (param.startsWith("expires")) { try { cookie.expiry = HttpDateFormat.readDate(value + ", " + bites[++i]); } catch (ParseException e) { LOGGER.log(Level.FINE, LocalizationMessages.ERROR_NEWCOOKIE_EXPIRES(value), e);
/** * Read a date. * * @param date the date as a string. * * @return the date * @throws java.text.ParseException in case the date string cannot be parsed. */ public static Date readDate(final String date) throws ParseException { ParseException pe = null; for (final SimpleDateFormat f : HttpDateFormat.getDateFormats()) { try { Date result = f.parse(date); // parse can change time zone -> set it back to GMT f.setTimeZone(GMT_TIME_ZONE); return result; } catch (final ParseException e) { pe = (pe == null) ? e : pe; } } throw pe; } }
private Date createDate(final String name) throws ParseException { final String value = parameters.get(name); if (value == null) { return null; } return HttpDateFormat.getPreferredDateFormat().parse(value); }
@Override public T fromString(final String value) { if (value == null) { throw new IllegalArgumentException(LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value")); } try { return rawType.cast(HttpDateFormat.readDate(value)); } catch (final ParseException ex) { throw new ExtractorException(ex); } }