Code example for EntityTemplate

0
        body.setContentType(contentType);
        response.setEntity(body);
    } 
 
    private EntityTemplate createEntity() {
        return new EntityTemplate(new ContentProducer() {
            public void writeTo(OutputStream outputStream) throws IOException {
                OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
                writer.write(payload);
                writer.flush();
            } 
        }); 
    } 
 
    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    } 
 
    public void setContentType(String contentType) {
        this.contentType = contentType;
Contextual code suggestions in your IDE  Get Codota for Java