HttpClient 源码详解之HttpRequestBase

版权声明:如若转载,请联系作者。 https://blog.csdn.net/liu16659/article/details/84402045

HttpClient 源码详解之HttpRequestBase

1. 类释义

* Base implementation of {@link HttpUriRequest}.

2. 基本方法

  • getURI()
    返回初始的请求URI【这个URI不会随着重定位或者请求的更新而改变】
    /**
     * Returns the original request URI.

     * Please note URI remains unchanged in the course of request execution and
     * is not updated if the request is redirected to another location.
     */
    @Override
    public URI getURI() {
        return this.uri;
    }

示例如下:

public final static void main(String[] args) throws Exception {  
     //define a httpGet
	 HttpGet httpget = new HttpGet("http://www.baidu.com");
     System.out.println("Executing request " + httpget.getURI());           
    }

执行结果如下:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/liu16659/article/details/84402045