use of io.milton.http.Response.Entity in project lobcder by skoulouzis.
the class ResponseAdapter method setTargetEntity.
// Grab the Milton entity, wrap it in a Restlet entity, set it on target
public void setTargetEntity() {
final Entity entity;
if ((entity = getEntity()) != null) {
MediaType contentType = MediaType.valueOf(getContentTypeHeader());
getTarget().setEntity(new OutputRepresentation(contentType) {
@Override
public void write(OutputStream outputStream) throws IOException {
try {
entity.write(ResponseAdapter.this, outputStream);
} catch (IOException ex) {
throw ex;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
});
}
}
Aggregations