Code example for StringEntity

0
    public void setEntity(HttpEntity data) throws Exception {
        entity = data;
    } 
 
    public void setEntity(String data) throws Exception {
        entity = new StringEntity(data, DEFAULT_ENCODING);
    } 
 
    public boolean isMethodSupported(String method) {
        if (method.equals("POST")) {
            return true; 
        } else if (method.equals("PUT")) {
            return true; 
        } else if (method.equals("GET")) {
            return true; 
        } 
        return false; 
    } 
 
    public void setMethod(String method) throws Exception {
        if (!isMethodSupported(method)) {