On May 5, 2008, at 6:57 PM, sdumitriu (SVN) wrote:
Author: sdumitriu
Date: 2008-05-05 18:57:49 +0200 (Mon, 05 May 2008)
New Revision: 9648
Modified:
xwiki-platform/core/branches/xwiki-core-1.4/xwiki-core/src/main/
java/com/xpn/xwiki/XWiki.java
xwiki-platform/core/branches/xwiki-core-1.4/xwiki-core/src/main/
java/com/xpn/xwiki/util/Util.java
xwiki-platform/core/branches/xwiki-core-1.4/xwiki-core/src/main/
java/com/xpn/xwiki/web/SkinAction.java
Log:
XWIKI-2360: Add correct Last-Modification header for filesystem skin
files
Done
Patch submitted by Raffaello Pelagalli, applied with some changes
Merged from trunk@9646
Modified: xwiki-platform/core/branches/xwiki-core-1.4/xwiki-core/src/
main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- xwiki-platform/core/branches/xwiki-core-1.4/xwiki-core/src/main/
java/com/xpn/xwiki/XWiki.java 2008-05-05 16:56:00 UTC (rev 9647)
+++ xwiki-platform/core/branches/xwiki-core-1.4/xwiki-core/src/main/
java/com/xpn/xwiki/XWiki.java 2008-05-05 16:57:49 UTC (rev 9648)
@@ -931,6 +931,19 @@
return Util.getFileContent(new InputStreamReader(is));
}
+ public Date getResourceLastModificationDate(String name)
+ {
+ try {
+ if (getEngineContext() != null) {
+ return
Util
.getFileLastModificationDate(getEngineContext().getRealPath(name));
+ }
+ } catch (Exception ex) {
+ // Probably a SecurityException or the file is not
accessible (inside a war)
+ LOG.info("Failed to get file modification date: " +
ex.getMessage());
I think this should be warn and not an info, WDYT?
We should also explain the message that the current date will be used
instead I think.
[snip]
+ public static Date
getFileLastModificationDate(String path) {
+ try {
+ File f = new File(path);
+ return (new Date(f.lastModified()));
+ } catch (Exception ex) {
+ return new Date();
Shouldn't we display a warn message here too? If not, then we should
have a comment to explain why we don't want a message...
Thanks
-Vincent