You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Lance Woodson <la...@capitalthought.com> on 2006/08/07 16:11:15 UTC
HttpClient - downloading samples of resources
I'm using HttpClient for a project where we are automating the
pushing/pulling of files using various protocols. These are data files
that may be in varying formats (tab delimited, comma delimited, relevant
data in different columns, etc...). One desired feature is to allow a
test function, wherein a small sample is taken from the file -- say the
first 10 lines -- which is then parsed according to the users formatting
settings and displayed back to the user so they can see if there are any
problems with the way they have set the transfer up.
I know it is a longshot, but I'll go ahead and ask: Is there anyway
that HttpClient could be used to download only a portion of a file
delivered from a web server? Or am I going to have to look into using
lower-level IO to implement this?
________________________________________
SKYLIST
Email Marketing Solutions that Deliver
Service You Can Trust
You are receiving this email message
from a representative of SKYLIST, Inc.
701 Brazos, Ste 700, Austin, TX 78701
Toll Free: 877.250.2922
To cease all communication with SKYLIST, visit
http://www.skylist.net/unsubscribe
or send an email to unsubscribe@skylist.com
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: HttpClient - downloading samples of resources
Posted by Lance Woodson <la...@capitalthought.com>.
Thanks, Oleg, your response is much appreciated.
Oleg Kalnichevski wrote:
> On Mon, 2006-08-07 at 09:11 -0500, Lance Woodson wrote:
>
>> I'm using HttpClient for a project where we are automating the
>> pushing/pulling of files using various protocols. These are data files
>> that may be in varying formats (tab delimited, comma delimited, relevant
>> data in different columns, etc...). One desired feature is to allow a
>> test function, wherein a small sample is taken from the file -- say the
>> first 10 lines -- which is then parsed according to the users formatting
>> settings and displayed back to the user so they can see if there are any
>> problems with the way they have set the transfer up.
>>
>> I know it is a longshot, but I'll go ahead and ask: Is there anyway
>> that HttpClient could be used to download only a portion of a file
>> delivered from a web server? Or am I going to have to look into using
>> lower-level IO to implement this?
>>
>>
>
> There are two options. (1) Just abort the method by calling
> HttpMethod#abort after having read the required part of the response
> content. (2) Use Range directive (for details see RFC2616, section 14.35
> [1])
>
> Oleg
>
> [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>
>
>> ________________________________________
>>
>> SKYLIST
>> Email Marketing Solutions that Deliver
>> Service You Can Trust
>>
>> You are receiving this email message
>> from a representative of SKYLIST, Inc.
>> 701 Brazos, Ste 700, Austin, TX 78701
>> Toll Free: 877.250.2922
>>
>> To cease all communication with SKYLIST, visit
>> http://www.skylist.net/unsubscribe
>> or send an email to unsubscribe@skylist.com
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
>
________________________________________
SKYLIST
Email Marketing Solutions that Deliver
Service You Can Trust
You are receiving this email message
from a representative of SKYLIST, Inc.
701 Brazos, Ste 700, Austin, TX 78701
Toll Free: 877.250.2922
To cease all communication with SKYLIST, visit
http://www.skylist.net/unsubscribe
or send an email to unsubscribe@skylist.com
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: HttpClient - downloading samples of resources
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2006-08-07 at 09:11 -0500, Lance Woodson wrote:
> I'm using HttpClient for a project where we are automating the
> pushing/pulling of files using various protocols. These are data files
> that may be in varying formats (tab delimited, comma delimited, relevant
> data in different columns, etc...). One desired feature is to allow a
> test function, wherein a small sample is taken from the file -- say the
> first 10 lines -- which is then parsed according to the users formatting
> settings and displayed back to the user so they can see if there are any
> problems with the way they have set the transfer up.
>
> I know it is a longshot, but I'll go ahead and ask: Is there anyway
> that HttpClient could be used to download only a portion of a file
> delivered from a web server? Or am I going to have to look into using
> lower-level IO to implement this?
>
There are two options. (1) Just abort the method by calling
HttpMethod#abort after having read the required part of the response
content. (2) Use Range directive (for details see RFC2616, section 14.35
[1])
Oleg
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>
>
> ________________________________________
>
> SKYLIST
> Email Marketing Solutions that Deliver
> Service You Can Trust
>
> You are receiving this email message
> from a representative of SKYLIST, Inc.
> 701 Brazos, Ste 700, Austin, TX 78701
> Toll Free: 877.250.2922
>
> To cease all communication with SKYLIST, visit
> http://www.skylist.net/unsubscribe
> or send an email to unsubscribe@skylist.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org