String state ="teststate";
String url="https://open.youzan.com/oauth/authorize";
@RequestMapping(value="/",method= RequestMethod.GET)
public void test(){
HttpClient httpClient = new DefaultHttpClient();
HttpClient.Params params = HttpClient.Params.custom()
.add("client_id", "***********")
.add("response_type", "code")
.add("state", "state")
.add("redirect_uri","http://youzanyun.com/callback")
.build();
//.setContentType(ContentType.APPLICATION_FORM_URLENCODED)
String resp = httpClient.post(url, params);
//String resp =httpClient.get(url,params);
System.out.println(resp);
System.out.println(state);
//System.out.println(httpClient.get(url));
}
请问这样写是不是有错误?
运行后得到的是Unsupported Media Typeteststate
请问应该怎么改?求各位大神帮助!!!
本帖最后由 chengyifan 于 2018-9-21 16:51 编辑
|
|
用手机打开
收藏
赞 0
···
回复
|
|
|
|