H
Hal Vaughan
I'm working a simple method to read web pages and experimenting with a few
aspects.
I've noticed if the URL contains POST data (and I'm just specifying the POST
data in the URL), when I try URLConnection().getContentLength(), I often
get a length of -1. I don't see this happen on any web pages without any
post data.
Is this because the page is generated dynamically and the server may not be
reporting the length for a posted page but is reporting it for a static
page?
I've tested different configurations in programs and even copied different
examples from web pages to test this out, but the effect is code
independent.
Here are two example pages:
Length reported correctly:
<http://www.archive.org/download/361...es/361003WorldSeriesGiantsVsYankees_files.xml>
Length reported as -1:
<http://www.archive.org/search.php?page=1&query=collection:oldtimeradio&sort=title>
I don't think this is a Java language issue, but more a factor of what data
one gets back from a server. Am I right about this? Is it a server issue?
The server, according to Netcraft, is running Apache.
Hal
aspects.
I've noticed if the URL contains POST data (and I'm just specifying the POST
data in the URL), when I try URLConnection().getContentLength(), I often
get a length of -1. I don't see this happen on any web pages without any
post data.
Is this because the page is generated dynamically and the server may not be
reporting the length for a posted page but is reporting it for a static
page?
I've tested different configurations in programs and even copied different
examples from web pages to test this out, but the effect is code
independent.
Here are two example pages:
Length reported correctly:
<http://www.archive.org/download/361...es/361003WorldSeriesGiantsVsYankees_files.xml>
Length reported as -1:
<http://www.archive.org/search.php?page=1&query=collection:oldtimeradio&sort=title>
I don't think this is a Java language issue, but more a factor of what data
one gets back from a server. Am I right about this? Is it a server issue?
The server, according to Netcraft, is running Apache.
Hal