• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Java/Http Question

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm opening a socket and sending web pages to a client.
When I send the Html only, the <BACKGROUND> tag is never expanded to display the GIF image.
It seems that I need to send the Images as well as the Html. I've tried using the 'HTTP/1.1 206 Partial Content', in addition to sending both files concatenated as one big response.
Does anyone have an idea of how to get both parts to the browser at the same time?
Thanks
VG
 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
would u plz explain
what type of conection u r using
if u r using URLConnection
then its statless
u have to embade ur commands inside it & u have to filter it on the server side from the query string & send the response..
the other way is to use the socket connection....
let me know is the problem still exists...
 
Ranch Hand
Posts: 583
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Well I guess I had a similar praw.
I was developing a proxy server but then all went well but during the image tag the server started downloading the image it self..
how do I go about dev. a proxy without all these hassles?
Regds
Gautham Kasinath
 
Vernon Gibson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Thanks for your replies.
Maateen:
I am using a socket (result of ServerSocket.accept()).
Gautham & Maateen:
I have found through experamentation that the browser is sending multiple requests. The first is for the Html document. The subsequent requests are for the embedded document items (jpeg, etc.) This information is in the headers forwarded by the browser.
So the solution was:
1) open the socket
2) read the request
3) identify the resource requested
4) send the resource to the browser
5) close the socket
This logic is in a loop based off the ServerSocket.accept(), so each new request opens a new socket.
By the way RFC2616 says that in Http 1.1 protocol you should keep the socket open, but the ServerSocket.accept() method opens a new socket with each request, so I'm closing them when I process the request.
Thanks,
VG
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic