My goal is to build a new HttpResponse
out of an old one.
My attempt is this:
String headers = dbh.getResponseHeaders(url);
InputStream content = dbh.getResponseContent(url);
final HttpResponse cachedResponseToReturn = response;
cachedResponseToReturn.setHeaders(null);
final StringEntity sEntity = new StringEntity(content.toString()); ////these lines
cachedResponseToReturn.setEntity(sEntity); ////these lines
final LinkedList<String[]> h开发者_高级运维eadersList = divideStringToAllTheHeaders(headers);
for (int i = 0; i < headersList.size(); ++i)
cachedResponseToReturn.addHeader(headersList.get(i)[0], headersList.get(i)[1]);
By the way, the 'response' variable is an HttpResponse to initialize the new response. I only use it to initialization.
In other words, how do I set the content of the HttpResponse
type that I have?
tnx, Itamar.
精彩评论