Code example for EntityTemplate

Methods: setContentType

0
                 
                final String output = this.thriftRequest(entityContent); 
                 
                System.out.println("Outgoing content: "+output); 
                 
                EntityTemplate body = new EntityTemplate(new ContentProducer() { 
 
                    public void writeTo(final OutputStream outstream) throws IOException { 
                        OutputStreamWriter writer = new OutputStreamWriter(outstream, "UTF-8"); 
                        writer.write(output); 
                        writer.flush(); 
                    } 
 
                }); 
                body.setContentType("text/html; charset=UTF-8"); 
                response.setEntity(body); 
            } else { 
 
                final File file = new File(this.docRoot, URLDecoder.decode(target)); 
                if (!file.exists()) {