use of ch.cyberduck.core.date.RFC1123DateFormatter in project cyberduck by iterate-ch.
the class InfoController method metadataAddExpiresClicked.
@Action
public void metadataAddExpiresClicked(ID sender) {
final Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.add(Calendar.SECOND, preferences.getInteger("s3.cache.seconds"));
this.addMetadataItem("Expires", new RFC1123DateFormatter().format(time.getTime(), TimeZone.getTimeZone("UTC")));
}
use of ch.cyberduck.core.date.RFC1123DateFormatter in project cyberduck by iterate-ch.
the class DAVAttributesFinderFeatureTest method testCustomModified_NotModified.
@Test
public void testCustomModified_NotModified() throws Exception {
final DAVAttributesFinderFeature f = new DAVAttributesFinderFeature(null);
final DavResource mock = mock(DavResource.class);
Map<QName, String> map = new HashMap<>();
final String ts = "Mon, 29 Oct 2018 21:14:06 UTC";
map.put(DAVTimestampFeature.LAST_MODIFIED_CUSTOM_NAMESPACE, ts);
map.put(DAVTimestampFeature.LAST_MODIFIED_SERVER_CUSTOM_NAMESPACE, "Thu, 01 Nov 2018 15:31:57 UTC");
when(mock.getModified()).thenReturn(new DateTime("2018-11-01T15:31:57Z").toDate());
when(mock.getCustomPropsNS()).thenReturn(map);
final PathAttributes attrs = f.toAttributes(mock);
assertEquals(new RFC1123DateFormatter().parse(ts).getTime(), attrs.getModificationDate());
}
use of ch.cyberduck.core.date.RFC1123DateFormatter in project cyberduck by iterate-ch.
the class MicrosoftIISDAVTimestampFeature method getCustomProperties.
protected List<Element> getCustomProperties(final DavResource resource, final Long modified) {
final List<Element> props = new ArrayList<>();
final Element element = SardineUtil.createElement(LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE);
element.setTextContent(new RFC1123DateFormatter().format(modified, TimeZone.getTimeZone("GMT")));
props.add(element);
return props;
}
use of ch.cyberduck.core.date.RFC1123DateFormatter in project cyberduck by iterate-ch.
the class DAVTimestampFeature method getCustomProperties.
protected List<Element> getCustomProperties(final DavResource resource, final Long modified) {
final List<Element> props = new ArrayList<>();
if (resource.getModified() != null) {
Element element = SardineUtil.createElement(LAST_MODIFIED_SERVER_CUSTOM_NAMESPACE);
element.setTextContent(new RFC1123DateFormatter().format(resource.getModified(), TimeZone.getTimeZone("UTC")));
props.add(element);
}
Element element = SardineUtil.createElement(LAST_MODIFIED_CUSTOM_NAMESPACE);
element.setTextContent(new RFC1123DateFormatter().format(modified, TimeZone.getTimeZone("UTC")));
props.add(element);
return props;
}
use of ch.cyberduck.core.date.RFC1123DateFormatter in project cyberduck by iterate-ch.
the class MicrosoftIISDAVAttributesFinderFeatureTest method testCustomModified_PropertyAvailable.
@Test
public void testCustomModified_PropertyAvailable() throws Exception {
final MicrosoftIISDAVAttributesFinderFeature f = new MicrosoftIISDAVAttributesFinderFeature(null);
final DavResource mock = mock(DavResource.class);
Map<QName, String> map = new HashMap<>();
final String ts = "Mon, 29 Oct 2018 21:14:06 GMT";
map.put(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE, ts);
when(mock.getModified()).thenReturn(new DateTime("2018-11-01T15:31:57Z").toDate());
when(mock.getCustomPropsNS()).thenReturn(map);
final PathAttributes attrs = f.toAttributes(mock);
assertEquals(new RFC1123DateFormatter().parse(ts).getTime(), attrs.getModificationDate());
}
Aggregations