java跨域请求 (post raw参数请求)

    public String cat(String josn,String url) throws ClientProtocolException, IOException {
        HttpClient httpClient = new DefaultHttpClient(); 
        HttpPost post = new HttpPost(url); 
        StringEntity postingString = new StringEntity(josn);
        post.setEntity(postingString); 
        post.setHeader("Content-type", "application/json"); 
        HttpResponse response = httpClient.execute(post); 
        String content = EntityUtils.toString(response.getEntity());
        return content;
    }

 


版权声明:本文为qq_15024009原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。