/** * Parses a date value. The formats used for parsing the date value are retrieved from * the default http params. * * @param dateValue the date value to parse * * @return the parsed date * * @throws DateParseException if the value could not be parsed using any of the * supported date formats */ public static Date parseDate(String dateValue) throws DateParseException { return parseDate(dateValue, null, null); }
/** * Parses the date value using the given date formats. * * @param dateValue the date value to parse * @param dateFormats the date formats to use * * @return the parsed date * * @throws DateParseException if none of the dataFormats could parse the dateValue */ public static Date parseDate(String dateValue, Collection dateFormats) throws DateParseException { return parseDate(dateValue, dateFormats, null); }
DateUtil.parseDate(header.substring(i1, i2), this.datepatterns); isNetscapeCookie = true; } catch (DateParseException e) {
cookie.setExpiryDate(DateUtil.parseDate(paramValue, this.datepatterns)); } catch (DateParseException dpe) { LOG.debug("Error parsing cookie date", dpe);
/** * Parses the date value using the given date formats. * * @param dateValue the date value to parse * @param dateFormats the date formats to use * * @return the parsed date * * @throws DateParseException if none of the dataFormats could parse the dateValue */ public static Date parseDate(String dateValue, Collection dateFormats) throws DateParseException { return parseDate(dateValue, dateFormats, null); }
/** * Parses a date value. The formats used for parsing the date value are retrieved from * the default http params. * * @param dateValue the date value to parse * * @return the parsed date * * @throws DateParseException if the value could not be parsed using any of the * supported date formats */ public static Date parseDate(String dateValue) throws DateParseException { return parseDate(dateValue, null, null); }
/** * Parses a date value. The formats used for parsing the date value are retrieved from * the default http params. * * @param dateValue the date value to parse * * @return the parsed date * * @throws DateParseException if the value could not be parsed using any of the * supported date formats */ public static Date parseDate(String dateValue) throws DateParseException { return parseDate(dateValue, null, null); }
/** * Parses a date value. The formats used for parsing the date value are retrieved from * the default http params. * * @param dateValue the date value to parse * * @return the parsed date * * @throws DateParseException if the value could not be parsed using any of the * supported date formats */ public static Date parseDate(String dateValue) throws DateParseException { return parseDate(dateValue, null, null); }
/** * Parses the date value using the given date formats. * * @param dateValue the date value to parse * @param dateFormats the date formats to use * * @return the parsed date * * @throws DateParseException if none of the dataFormats could parse the dateValue */ public static Date parseDate(String dateValue, Collection dateFormats) throws DateParseException { return parseDate(dateValue, dateFormats, null); }
private static int getVersion(HttpMethod httpMethod) throws DateParseException { int version = 0; Header header = httpMethod.getResponseHeader(LAST_MODIFIED_HEADER); if (header != null) { String lastModified = header.getValue(); Date lastModifiedDate = DateUtil.parseDate(lastModified); SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN); version = Integer.parseInt(sdf.format(lastModifiedDate)); } return version; }
/** * Returns the date value of the specified header */ public Date getDateHeader(String header) { String val = getHeader(header); try { return (val != null) ? DateUtil.parseDate(val) : null; } catch (DateParseException e) { throw new RuntimeException(e); } }
private static int getVersion(HttpMethod httpMethod) throws DateParseException { int version = 0; Header header = httpMethod.getResponseHeader(LAST_MODIFIED_HEADER); if (header != null) { String lastModified = header.getValue(); Date lastModifiedDate = DateUtil.parseDate(lastModified); SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN); version = Integer.parseInt(sdf.format(lastModifiedDate)); } return version; }
private long parseStringDate(String value) { try { return DateUtil.parseDate(value).getTime(); } catch (DateParseException e) { throw new IllegalStateException("Could not parse Last-Modified header with value " + value + " : " + e.getMessage()); } }
/** * Return the named HTTP header as a java.util.Date */ public Date getDateHeader(String header) { try { String value = getHeader(header); if (value != null) return DateUtil.parseDate(value); else return null; } catch (DateParseException e) { return null; // treat other invalid date formats, especially including the value "0", as in the past } } }
/** * Returns the last modified time of this file. * <p> * This implementation throws an exception. */ @Override protected long doGetLastModifiedTime() throws Exception { final Header header = method.getResponseHeader("last-modified"); FileSystemException.requireNonNull(header, "vfs.provider.http/last-modified.error", getName()); return DateUtil.parseDate(header.getValue()).getTime(); }
/** * Returns the last modified time of this file. * <p> * This implementation throws an exception. */ @Override protected long doGetLastModifiedTime() throws Exception { final Header header = method.getResponseHeader("last-modified"); if (header == null) { throw new FileSystemException("vfs.provider.http/last-modified.error", getName()); } return DateUtil.parseDate(header.getValue()).getTime(); }
/** * Returns the last modified time of this file. * <p> * This implementation throws an exception. */ @Override protected long doGetLastModifiedTime() throws Exception { final Header header = method.getResponseHeader("last-modified"); if (header == null) { throw new FileSystemException("vfs.provider.http/last-modified.error", getName()); } return DateUtil.parseDate(header.getValue()).getTime(); }
/** * Returns the last modified time of this file. Is only called if {@link #doGetType} does not return * {@link FileType#IMAGINARY}. */ @Override protected long doGetLastModifiedTime() throws Exception { final DavProperty property = getProperty((URLFileName) getName(), DavConstants.PROPERTY_GETLASTMODIFIED); if (property != null) { final String value = (String) property.getValue(); return DateUtil.parseDate(value).getTime(); } return 0; }
/** * Returns the last modified time of this file. Is only called if {@link #doGetType} does not return * {@link FileType#IMAGINARY}. */ @Override protected long doGetLastModifiedTime() throws Exception { final DavProperty property = getProperty((URLFileName) getName(), DavConstants.PROPERTY_GETLASTMODIFIED); if (property != null) { final String value = (String) property.getValue(); return DateUtil.parseDate(value).getTime(); } return 0; }
/** * Returns the last modified time of this file. Is only called if {@link #doGetType} does not return * {@link FileType#IMAGINARY}. */ @Override protected long doGetLastModifiedTime() throws Exception { final DavProperty property = getProperty((URLFileName) getName(), DavConstants.PROPERTY_GETLASTMODIFIED); if (property != null) { final String value = (String) property.getValue(); return DateUtil.parseDate(value).getTime(); } return 0; }