You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by tk...@apache.org on 2016/10/19 14:04:46 UTC
[4/6] marmotta git commit: Use different date serializations for uris
and other places (e.g. links, headers, etc.)
Use different date serializations for uris and other places (e.g. links, headers, etc.)
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/ea07757c
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/ea07757c
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/ea07757c
Branch: refs/heads/MARMOTTA-655_Memento_Compliance_Issues
Commit: ea07757c176138c5a59b3cace0c1249e48711e68
Parents: badefd3
Author: Thomas Kurz <th...@salzburgresearch.at>
Authored: Thu Oct 13 18:09:52 2016 +0200
Committer: Thomas Kurz <th...@salzburgresearch.at>
Committed: Thu Oct 13 18:09:52 2016 +0200
----------------------------------------------------------------------
.../marmotta/platform/versioning/model/MementoVersionSet.java | 2 +-
.../apache/marmotta/platform/versioning/utils/MementoUtils.java | 5 ++++-
.../platform/versioning/webservices/MementoWebService.java | 2 +-
.../src/main/resources/templates/memento_timemap.ftl | 4 ++--
4 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/ea07757c/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/model/MementoVersionSet.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/model/MementoVersionSet.java b/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/model/MementoVersionSet.java
index 594cab8..c1a71c2 100644
--- a/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/model/MementoVersionSet.java
+++ b/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/model/MementoVersionSet.java
@@ -70,7 +70,7 @@ public class MementoVersionSet {
}
private String buildLink( String prefix, String resource, Date date, String rel ) {
- return "<" + prefix + MementoUtils.MEMENTO_DATE_FORMAT.format(date) + "/" + resource +
+ return "<" + prefix + MementoUtils.MEMENTO_DATE_FORMAT_FOR_URIS.format(date) + "/" + resource +
">;datetime=\"" + MementoUtils.MEMENTO_DATE_FORMAT.format(date) + "\";rel=\"" + rel +"\"";
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/ea07757c/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/utils/MementoUtils.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/utils/MementoUtils.java b/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/utils/MementoUtils.java
index 5fa2f71..5742952 100644
--- a/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/utils/MementoUtils.java
+++ b/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/utils/MementoUtils.java
@@ -36,9 +36,12 @@ public class MementoUtils {
/**
* is used for date format used in memento resource uris
+ * TODO should be HTTP Date format specified by RFC 1123 and in the GMT timezone like "Mon, 19 Sep 2016 23:47:12 GMT"
*/
public static final DateFormat MEMENTO_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
+ public static final DateFormat MEMENTO_DATE_FORMAT_FOR_URIS = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
+
/**
* builds a memento permalink
* @param date the date of the version that should be represented by the permalink
@@ -50,7 +53,7 @@ public class MementoUtils {
baseURI +
MEMENTO_WEBSERVICE + "/" +
MEMENTO_RESOURCE + "/" +
- MEMENTO_DATE_FORMAT.format(date) + "/" +
+ MEMENTO_DATE_FORMAT_FOR_URIS.format(date) + "/" +
resource);
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/ea07757c/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java b/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java
index 9d35e59..9174715 100644
--- a/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java
+++ b/platform/marmotta-versioning-kiwi/src/main/java/org/apache/marmotta/platform/versioning/webservices/MementoWebService.java
@@ -179,7 +179,7 @@ public class MementoWebService {
RepositoryConnection conn = sesameService.getConnection();
try {
- final Date date = MementoUtils.MEMENTO_DATE_FORMAT.parse(date_string);
+ final Date date = MementoUtils.MEMENTO_DATE_FORMAT_FOR_URIS.parse(date_string);
final URI resource = conn.getValueFactory().createURI(resource_string);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/ea07757c/platform/marmotta-versioning-kiwi/src/main/resources/templates/memento_timemap.ftl
----------------------------------------------------------------------
diff --git a/platform/marmotta-versioning-kiwi/src/main/resources/templates/memento_timemap.ftl b/platform/marmotta-versioning-kiwi/src/main/resources/templates/memento_timemap.ftl
index 92f4745..4deff79 100644
--- a/platform/marmotta-versioning-kiwi/src/main/resources/templates/memento_timemap.ftl
+++ b/platform/marmotta-versioning-kiwi/src/main/resources/templates/memento_timemap.ftl
@@ -56,7 +56,7 @@
var target = "#timeknots",
v = [
<#list versions as version>
- {'name':"${version.date}", 'date':new Date("${version.tstamp}"), 'uri':"${version.uri}"},
+ {'name':"${MEMENTO_DATE_FORMAT.format(version.date)}", 'date':new Date("${version.tstamp}"), 'uri':"${version.uri}"},
</#list>
{'name':"now", 'date':new Date(),'lineWidth':1, 'uri':"${SERVER_URL}resource?uri=${original?url}"}
];
@@ -88,7 +88,7 @@
</tr>
<#list versions as version>
<tr>
- <td><a target="_blank" href="${version.uri}" class="ldcache">${version.date}</a></td>
+ <td><a target="_blank" href="${version.uri}" class="ldcache">${MEMENTO_DATE_FORMAT.format(version.date)}</a></td>
</tr>
</#list>
</table>