You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2008/06/05 23:52:39 UTC
svn commit: r663753 - in /ant/ivy/core/trunk: CHANGES.txt
src/java/org/apache/ivy/util/url/BasicURLHandler.java
src/java/org/apache/ivy/util/url/HttpClientHandler.java
Author: maartenc
Date: Thu Jun 5 14:52:39 2008
New Revision: 663753
URL: http://svn.apache.org/viewvc?rev=663753&view=rev
Log:
IMPROVEMENT: Set the last modified attribute of files downloaded from repositories (IVY-823)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java
ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=663753&r1=663752&r2=663753&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Jun 5 14:52:39 2008
@@ -71,6 +71,7 @@
- NEW: Add a new resolve mode (optionally per module) to utilize dynamic constraint rule metadata (IVY-740)
- NEW: Add transitive dependency version and branch override mechanism (IVY-784)
+- IMPROVEMENT: Set the last modified attribute of files downloaded from repositories (IVY-823)
- IMPROVEMENT: If DNS is playing up, Ivy takes a lot longer to sort project dependencies (IVY-817)
- IMPROVEMENT: make it possible to specify permissions of published files for the SSH resolver (IVY-764)
- IMPROVEMENT: Load Ivy version number into some Ant property (IVY-790)
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java?rev=663753&r1=663752&r2=663753&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java Thu Jun 5 14:52:39 2008
@@ -134,6 +134,10 @@
"Downloaded file size doesn't match expected Content Length for " + src
+ ". Please retry.");
}
+ long lastModified = srcConn.getLastModified();
+ if (lastModified > 0) {
+ dest.setLastModified(lastModified);
+ }
} finally {
disconnect(srcConn);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java?rev=663753&r1=663752&r2=663753&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java Thu Jun 5 14:52:39 2008
@@ -92,6 +92,7 @@
public void download(URL src, File dest, CopyProgressListener l) throws IOException {
GetMethod get = doGet(src);
FileUtil.copy(get.getResponseBodyAsStream(), dest, l);
+ dest.setLastModified(getLastModified(get));
get.releaseConnection();
}
@@ -137,8 +138,8 @@
return UNAVAILABLE;
}
- private long getLastModified(HeadMethod head) {
- Header header = head.getResponseHeader("last-modified");
+ private long getLastModified(HttpMethodBase method) {
+ Header header = method.getResponseHeader("last-modified");
if (header != null) {
String lastModified = header.getValue();
try {