• Httpclient---------框架


    http://hc.apache.org/

    -----------------------------------------------------------------------------------------

    package com.course.httpclient;

    import org.apache.http.HttpResponse;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.methods.HttpGet;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.util.EntityUtils;
    import org.testng.annotations.Test;
    import java.io.IOException;
    public class MyHttpClient {
    @Test
    public void test1() throws IOException {
    //用来存放我们的结果
    System.out.println("");
    String result;
    HttpGet get=new HttpGet("http://127.0.0.1:8080/pinter/index");
    //用来执行get方法的
    HttpClient client=new DefaultHttpClient();
    HttpResponse response=client.execute(get);
    result=EntityUtils.toString(response.getEntity(),"utf-8") ;
    System.out.println(result);
    }
    }
  • 相关阅读:
    三范式
    作用域
    函数传参
    js数据类型
    纯css小图标
    js生成div
    js模拟微信聊天窗口
    js图片切换
    js this指向
    常用实体字符
  • 原文地址:https://www.cnblogs.com/520502-thy/p/15088009.html
Copyright © 2020-2023  润新知