[英]Java post request with parameters
我看到林通过带有特定参数的POST方法发送邀请,在firefox开发人员工具中它看起来像:
我通常使用Apache HttpClient
通过JAVA发送请求,因此如果需要参数,只需输入:
HttpClient client = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(url);
List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
urlParameters.add(new BasicNameValuePair("sn", "C02G8416DRJM"));
post.setEntity(new UrlEncodedFormEntity(urlParameters));
HttpResponse response = client.execute(post);
但是我可能不了解这种“树”结构的含义以及如何实现它。
你能建议我怎么做吗?
我不知道LinkedIn在做什么,但是对我来说,这就像JSON字符串的POST。 这是纯数据,不是url格式编码的键值对。 通常,将其作为纯字符串发送:
post.setEntity(new StringEntity("Hello, World"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.