@Test
    public void testAdd() throws IOException {
        HttpPost post = new HttpPost("http://localhost:8182/api/media/add?app=test&access_token=1234&fileName=测试一下.jpg&ContentType=image/jpeg");
        HttpEntity entity = new FileEntity(new File("C:\\Users\\Administrator\\Desktop\\C360_2013-06-24-08-44-38-027.jpg"));
        post.setEntity(entity);
        CloseableHttpClient httpClient = HttpClients.createDefault();
        CloseableHttpResponse response = httpClient.execute(post);
        System.out.println(response.getStatusLine().getStatusCode());
        response.close();
        httpClient.close();
    }

 

posted on 2015-03-06 00:48  梦中彩虹  阅读(3638)  评论(0编辑  收藏  举报