You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Steve Loughran <st...@iseran.com> on 2000/07/14 02:43:29 UTC

[patch] Get.java (was Re: Time-based dependencies)

----- Original Message -----
From: "Stefan Bodewig" <bo...@bost.de>
To: <an...@jakarta.apache.org>
Sent: Thursday, July 13, 2000 00:55
Subject: Re: Time-based dependencies


> >>>>> "SL" == Steve Loughran <st...@iseran.com> writes:
>
>  SL> [A more powerful variant GET task is something I've debated doing
>  SL> in my copious free time; full WebDAV method calls using the Slide
>  SL> client side is the ideal goal, but perhaps timestamping would be
>  SL> a useful first step].
>
> This will be more than welcome. Don't forget to write the same for the
> FTP part and include a corresponding PUT task 8^).

of course -along with user authentication & stuff, it would let me include
the remote drop as
part of the build file.

> Just kidding - something like this is on my veeeery long TODO list and
> it is far away at the end.

it's kind of far away from mine too.

I have, however, stuck in the tweaks needed for GET to only grab files if
they have changed, which I have tapped in in my spare time today. If you set
UseFiletime to true, then the if-modified-since header is set to the time of
the destination file (if it exists) and then on an HTTP URL the result of
the request is checked for returning not-modified before the content is
downloaded. In that case the task returns (and traces out 'not modified' to
the display)

However it's untested. I need to think of a suitable test matrix (and a
server to generate the test results). If someone wants to try it and let me
know, then great -especially if the test server is beyond the firewall.

There are two design issues which need thinking about too. Both are easy to
implement; it just depends on what people want.

1. non HTTP protocols.
 These may include timestamps, so the GET task could choose not to save the
content if it is older. Should it? (Even so, it wont work for FTP and other
protocols that dont include date/time)

2. Touching the file after download. I don't do it -but it would make sense
to steal the code from Touch.java to do exactly that on a post Java1.1 VM.

Comments?

    -Steve

[patch] Get.java

Posted by Steve Loughran <st...@iseran.com>.
Okay, here is a patch to Get.java which adds an optional timestamp for
controlling HTTP downloads.

When the useTimestamp flag is set, then the local file time is used for
controlling download -and any file downloaded has its time set to that of
the remote destination. [That is, if the download information includes a
file time *and* that time is greater than 1/1/70, which can't be
distinguished from 'no timestamp', and the JVM is >= Java1.2)

I have also added the build.xml file to test it, which is somewhat fiddlier
than usual due to the need to test against a web server. And the three test
files I use have been stuck up on an externally accessible web server to
round everything off. Once (if) the patch is applied to Get.java, I'll
submit some documentation changes to match.

An FTP/HTTP PUT counterpart is likely only when I need to use it myself
enough to justify the effort.

-Steve

----- Original Message -----
From: "Stefan Bodewig" <bo...@bost.de>
To: <an...@jakarta.apache.org>
Sent: Friday, July 14, 2000 02:38
Subject: Re: [patch] Get.java (was Re: Time-based dependencies)

>  SL> 2. Touching the file after download.
>
> Take a look at Expand or Untar for examples of abusing Touch for this.
>
> Stefan
>

You know, there is indeed a fair amount of touch abuse going on. I believe
the touch functionality should really be moved into the Project class at
some point in time.

Re: [patch] Get.java (was Re: Time-based dependencies)

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "SL" == Steve Loughran <st...@iseran.com> writes:

 SL> However it's untested. I need to think of a suitable test matrix
 SL> (and a server to generate the test results).

Unfortunately I don't live behind a firewall either so I cannot help
you much with regard to testing - or should I say fortunately. As the
Java URLConnection stuff is supposed to do most of the magic, your
code should work - though I didn't test it either.

Please change the code to setUseFiletime to either take a boolean
argument (requires a rather recent Ant) or use Project.toBoolean to
line up with the boolean like attributes of other tasks.

 SL> (Even so, it wont work for FTP and other protocols that dont
 SL> include date/time)

Well, one could do the FTP stuff oneself and try to parse the result to
the LIST command ... That's half way to a PUT task I guess.

 SL> 2. Touching the file after download.

Take a look at Expand or Untar for examples of abusing Touch for this.

Stefan