I have a servlet JAVA application running under Tomcat 5.x. This web application essentially has to act like a browser given GET requests from a separate JAVA client running.
1. Client makes a series GET request to server
2. Server goes out to internet to get content and converts content to a byte array.
3. Server returns content to client for display
I know this sounds bizarre but it's legacy code I have to get working with no choice. I need to come up with the best and most efficient JAVA solution for step # 2.
The legacy code opens up a raw Socket and gets the content. But, there are problems with this. It's very slow and sometimes only returns only a small portion of the content.
I was thinking replacing Socket with HttpURLConnection class. First, does anyone have any ideas, in general, why the Socket class could have issues? Second, does anyone have working, robust code that does item #2?