1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.danube.webdav.fs.properties;
14
15 import org.abstracthorizon.danube.http.Status;
16 import org.abstracthorizon.danube.webdav.ResourceAdapter;
17 import org.abstracthorizon.danube.webdav.xml.XMLParserHandler;
18 import org.abstracthorizon.danube.webdav.xml.dav.response.properties.ResponseProperty;
19
20 import java.io.File;
21
22
23
24
25
26
27 public class GetLastModified extends org.abstracthorizon.danube.webdav.xml.dav.request.properties.GetLastModified {
28
29
30
31
32
33 public GetLastModified(XMLParserHandler parent) {
34 super(parent);
35 }
36
37
38
39
40
41
42
43 public ResponseProperty processSetProperty(ResourceAdapter adapter, Object resource) {
44 long newTimestamp = getLastModified();
45
46 File file = (File)resource;
47 long oldTimestamp = file.lastModified();
48 if (newTimestamp != oldTimestamp) {
49 file.setLastModified(newTimestamp);
50 File f = new File(file.getParentFile(), file.getName());
51 if (newTimestamp != f.lastModified()) {
52 return processResponse(adapter, file);
53 }
54 }
55 return constructResponse(Status.FORBIDDEN);
56 }
57 }
58