Class HttpRequest

java.lang.Object
com.bluersw.source.HttpRequest
All Implemented Interfaces:
DataSource

public class HttpRequest extends Object implements DataSource
通过HTTP和HTTPS协议获得响应结果 Get response results through HTTP and HTTPS protocols
Author:
sunweisheng
  • Constructor Summary

    Constructors
    Constructor
    Description
    通过要请求的URI构建请求对象 Construct the request object by the URI to be requested
  • Method Summary

    Modifier and Type
    Method
    Description
    get()
    获得GET请求的响应结果 Get the response result of GET request
    int
    获得请求结果HTTP状态码 Get request result HTTP status code
    获得请求结果HTTP状态的字符串说明 Get the string description of the HTTP status of the request result

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpRequest

      public HttpRequest(String uri)
      通过要请求的URI构建请求对象 Construct the request object by the URI to be requested
      Parameters:
      uri - 要请求的URI地址 URL
  • Method Details

    • getStatusLine

      public String getStatusLine()
      获得请求结果HTTP状态的字符串说明 Get the string description of the HTTP status of the request result
      Specified by:
      getStatusLine in interface DataSource
      Returns:
      HTTP状态的字符串说明 String description of HTTP status
    • getStatusCode

      public int getStatusCode()
      获得请求结果HTTP状态码 Get request result HTTP status code
      Specified by:
      getStatusCode in interface DataSource
      Returns:
      HTTP状态码 HTTP status code
    • get

      public String get() throws Exception
      获得GET请求的响应结果 Get the response result of GET request
      Specified by:
      get in interface DataSource
      Returns:
      响应结果 Response results
      Throws:
      Exception - 异常 Exception