I make some proxy server in andorid which modify http headers, it works ok, but I have to forward full response to 'top layer'.
How I can read whole response (all headers, content, everything) from HttpURLConnection?
HttpURLConnection httpURLConnection;
URL url = new URL(ADDRESS);
httpURLConnection = (HttpURLConnection) url.openConnection();
// add headers, write output stream, flush
if (httpURLConnection.getResponseCode() == HttpsURLConnection.HTTP_OK)
{
Map<String, List<String>> map = httpURLConnection.getHeaderFields();
System.out.println("Printing Response Header...\n");
for (Map.Entry<String, List<String>> entry : map.entrySet())
{
System.out.println("Key : " + entry.getKey() + " ,Value : " + entry.getValue());
}
return new DataInputStream(httpURLConnection.getInputStream());
}
In getInputStream I received only content it is possible to have some stream with whole reposne?