This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A simple proxy - problem returning response data to the client

 
uohz xela
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My programming assignment requires me to create a proxy in between client and server.
My client make a request to server through the proxy, then the proxy forwards it and returns back the response from the server to the client.

Here's the steps I took:

1) get request from client and store the request data into a byte array

2) read from the byte array using buffered reader

3) get the host name from the Host: header field and create a serverSocket with it

4) forward the request data to the serverSocket outputstream

5) retrieve the response data from the serverSocket inputstream into another byte array

6) write contents from the byte array into clientSocket output stream

However, after step 6, the browser is unable to display the response data. Any help?

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic