@CliCommand(value = { POST_HTTPSOURCE }, help = "POST data to http endpoint")
	public String postHttp(
			@CliOption(mandatory = false, key = { "", "target" }, help = "the location to post to", unspecifiedDefaultValue = "http://localhost:9000") String target,
			@CliOption(mandatory = false, key = "data", help = "the text payload to post. exclusive with file. embedded double quotes are not supported if next to a space character") String data,
			@CliOption(mandatory = false, key = "file", help = "filename to read data from. exclusive with data") File file,
			@CliOption(mandatory = false, key = "contentType", help = "the content-type to use. file is also read using the specified charset", unspecifiedDefaultValue = DEFAULT_MEDIA_TYPE) MediaType mediaType)
			throws IOException {
		Assert.isTrue(file != null || data != null, "One of 'file' or 'data' must be set");
		Assert.isTrue(file == null || data == null, "Only one of 'file' or 'data' must be set");
		if (mediaType.getCharSet() == null) {
			mediaType = new MediaType(mediaType, Collections.singletonMap("charset",
					Charset.defaultCharset().toString()));
		}

		if (file != null) {
			InputStreamReader isr = new InputStreamReader(new FileInputStream(file), mediaType.getCharSet());
			data = FileCopyUtils.copyToString(isr);
		}

		final StringBuilder buffer = new StringBuilder();
		URI requestURI = URI.create(target);

		final HttpHeaders headers = new HttpHeaders();
		headers.setContentType(mediaType);
		final HttpEntity<String> request = new HttpEntity<String>(data, headers);

		try {
			outputRequest("POST", requestURI, mediaType, data, buffer);
			ResponseEntity<String> response = createRestTemplate(buffer).postForEntity(requestURI, request, String.class);
			outputResponse(response, buffer);
			if (!response.getStatusCode().equals(HttpStatus.OK)) {
				buffer.append(OsUtils.LINE_SEPARATOR).append(
						String.format("Error sending data '%s' to '%s'", data, target));
			}
			return buffer.toString();
		}
		catch (ResourceAccessException e) {
			return String.format(buffer.toString() + "Failed to access http endpoint %s", target);
		}
		catch (Exception e) {
			return String.format(buffer.toString() + "Failed to send data to http endpoint %s", target);
		}
	}
Http commands.

@author Jon Brisbin
@author Ilayaperumal Gopinathan
@author Gunnar Hillert
@author Eric Bottard
@author David Turanski
spring-xd-shell/src/main/java/org/springframework/xd/shell/command/HttpCommands.java