Problem:Writing the response off a http message back to the client(web browser) does not return the full page if the page has images when using strings so i decided to use bytes but i still have the same issue.I have been able to get the header from the request as string and flushed it to the client but i am not sure what to do with the message to ensure that it appears properly on the web browser.
//This portion takes the message from the Httpurl connection inputstream
//the header has already been exttracted
//uc here represents a httpurlconnection
byte[] data = new byte[uc.getContentLength()];
int bytesRead = 0;
int offset = 0;
InputStream in = new BufferedInputStream(uc.getInputStream());
while (offset < uc.getContentLength()) {
bytesRead =in.read(data, offset, data.length-offset);
if (bytesRead == -1) break;
offset += bytesRead;