我知道我可以使用setParameter
方法添加http参数,但如何使用URIBuilder
类将正文传递给http请求?
例如,这个
URI uri = new URIBuilder().setScheme("http")
.setHost("localhost:9091/test").setParameter("a", "1")
.setParameter("b", "2").build();
等同于以下curl请求:
curl -X POST http://localhost:9091/test\?a\=1\&b\=2
但如何使用URIBuilder
(或任何其他类)为以下卷曲构建网址:
curl -X POST http://localhost:9091/test -d '{"a":1,"b":2}'
答案 0 :(得分:5)
v = datenum(2008, 1, 1):datenum(2010, 11, 31); % time vector
d = rand(1,length(v)); % data vector
fd = d;
alpha_o = 0.2;
for ii = 2:length(fd);
fd(ii) = alpha_o.*fd(ii) + (1-alpha_o).*fd(ii-1);
end
plot(v,d); hold on; plot(v,fd);