-
unable to load images from a webpage
I am developing a web-proxy server, which intercepts requests from the
browser, contacts the remote server and relays the response back to
the browser.However I have some problem with the way images are getting
displayed.Some images dont get displayed at all while others may be
half loaaded only.There is no problem with getting the text in the page
Just have a look at my code below and point out the potential problem :
RemoteUrl = new URL( url_string.trim() ) ;
ClientIn = new BufferedInputStream( RemoteUrl.openStream()) ;
outstream = new BufferedOutputStream( ClientSocket.getOutputStream() ) ;
byte[] buf = new byte[1024];
int len = 0;
try{
while ((len = ClientIn.read(buf)) >= 0)
outstream.write(buf,0,len);
-
Re: unable to load images from a webpage
Here's what the API documentation says about that "read" method:
Returns:
the total number of bytes read into the buffer, or -1 if there is no more
data because the end of the stream has been reached.
You are not comparing to -1.
PC2
"palash kasodhan" <palashkasodhan@yahoo.com> wrote in message
news:3bf05884$1@147.208.176.211...
>
> I am developing a web-proxy server, which intercepts requests from the
> browser, contacts the remote server and relays the response back to
> the browser.However I have some problem with the way images are getting
> displayed.Some images dont get displayed at all while others may be
> half loaaded only.There is no problem with getting the text in the page
> Just have a look at my code below and point out the potential problem :
>
>
>
> RemoteUrl = new URL( url_string.trim() ) ;
> ClientIn = new BufferedInputStream( RemoteUrl.openStream()) ;
> outstream = new BufferedOutputStream( ClientSocket.getOutputStream() ) ;
>
> byte[] buf = new byte[1024];
> int len = 0;
> try{
>
> while ((len = ClientIn.read(buf)) >= 0)
> outstream.write(buf,0,len);
>
>
>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks