Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Read input stream of HttpUrlConnection

Reply
Thread Tools

Read input stream of HttpUrlConnection

 
 
SPG
Guest
Posts: n/a
 
      07-26-2004
Hi,

One of our servers responds to an HTTP request by streaming text through the
response. It send a header back that specifies the content-length = 0.

Unfortunately the HttpUrlConnection determines that there is no data to read
and closes the stream.

I am sure there must be a way around this.. Any ideas?

Steve


 
Reply With Quote
 
 
 
 
Rogan Dawes
Guest
Posts: n/a
 
      07-26-2004
SPG wrote:

> Hi,
>
> One of our servers responds to an HTTP request by streaming text through the
> response. It send a header back that specifies the content-length = 0.
>
> Unfortunately the HttpUrlConnection determines that there is no data to read
> and closes the stream.
>
> I am sure there must be a way around this.. Any ideas?
>
> Steve
>
>


Hmmm. That's a tricky one. Let me see.

Oh, yes.

DON'T set the Content-Length header to 0 at the server! It is not
surprising that the UrlConnection terminates the connection if the
server says that it has no data.

If you have to stream data, perhaps a chunked encoded stream is a better
idea?

--
Rogan Dawes

*ALL* messages to will be dropped, and added
to my blacklist. Please respond to "nntp AT dawes DOT za DOT net"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read input value from dynamic created input controls Melissa ASP .Net 2 12-26-2008 07:48 AM
Conversion from Input Stream to Output Stream Kashif Ur Rehman Java 2 05-17-2007 07:50 PM
How to GET multi-word input from a *file* stream as opposed to a *console* stream? sherifffruitfly@gmail.com C++ 9 04-27-2006 04:14 PM
Creating an object that is read from an input stream. Jason Heyes C++ 21 12-15-2003 01:07 PM
how to read long[] from data input stream ? Jimmy Zhang Java 3 10-31-2003 07:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57