Code example for HttpEntity

Methods: getContentgetContentLengthgetContentType

0
		 
		//We support empty body... until we can't anymore 
		if(body != null)	{
			 
			// Make sure the  
			if(body.getContentType() != null)	{
				 
				// If we have json in the type, we're ok 
				if(body.getContentType().getValue().contains("json"))	{
					try { 
						CharBuffer buffer = CharBuffer.allocate((int)body.getContentLength());
						InputStreamReader reader = new InputStreamReader( body.getContent() );
						reader.read(buffer);
						this.array = new JSONArray(buffer.toString());
						converted = false;
					} catch (Exception e) {
						Logger.getLogger(JsonBackedModel.class.getName()).warning("Invalid request response received. Problem reading json content");
						array = null;
					} 
				} 
Connect your IDE to all the code out there  Get Codota for Java