// Status
UpnpResponse responseOperation =
new UpnpResponse(statusLine.getStatusCode(), statusLine.getReasonPhrase());
// Message
StreamResponseMessage responseMessage = new StreamResponseMessage(responseOperation);
// Headers
responseMessage.setHeaders(new UpnpHeaders(HeaderUtil.get(httpResponse)));
// Body
HttpEntity entity = httpResponse.getEntity();
if (entity == null || entity.getContentLength() == 0) return responseMessage;
if (responseMessage.isContentTypeMissingOrText()) {
log.fine("HTTP response message contains text entity");
responseMessage.setBody(UpnpMessage.BodyType.STRING, EntityUtils.toString(entity));
} else {
log.fine("HTTP response message contains binary entity");
responseMessage.setBody(UpnpMessage.BodyType.BYTES, EntityUtils.toByteArray(entity));
}
return responseMessage;
}
};