Examples of ResponseInfo


Examples of cn.baiweigang.qtaf.toolkit.httpclient.ResponseInfo

   *
   * @param testCase
   * @return ResponseInfo
   */
  public ResponseInfo execResquest(IftTestCase testCase) {
    ResponseInfo resInfo=new ResponseInfo();
    // 设置发起请求时使用的编码
    this.sendRequestCore.setCharset(testCase.getEnCoding());
    boolean flag = false;
    // 获取发起请求的http地址
    flag = this.updateHttpUrl(testCase);
    if (!flag) {
      log.info("发起http请求时,获取http地址失败");
      resInfo.setErrMsgInfo("发起http请求时,获取http地址失败");
      return resInfo;
    }
    // 获取发起请求的url参数信息
    flag = this.updateUrlPara(testCase);
    if (!flag) {
      log.info("发起http请求时,获取url参数信息失败");
      resInfo.setErrMsgInfo("发起http请求时,获取url参数信息失败");
      return resInfo;
    }
    // 获取发起请求的post参数信息
    flag = updateFormParaMap(testCase);
    if (!flag) {
      log.info("发起http请求时,获取post参数信息失败");
      resInfo.setErrMsgInfo("发起http请求时,获取post参数信息失败");
      return resInfo;
    }
    // 获取发起请求的headers信息
    flag = updateHeadersMap(testCase);
    if (!flag) {
      log.info("发起http请求时,获取headers信息失败");
      resInfo.setErrMsgInfo("发起http请求时,获取headers信息失败");
      return resInfo;
    }
    try {
      // 发起请求
      if (testCase.getHttpMethod().toLowerCase().equals("get")) {
        resInfo= sendRequestCore.get(headersMap, httpUrl + getUrl);
        resInfo.setHttpUrl(httpUrl + getUrl);
      } else if (testCase.getHttpMethod().toLowerCase().equals("post")) {
        resInfo= sendRequestCore.post(headersMap, httpUrl+getUrl, postUrl);
        resInfo.setHttpUrl("post请求的url信息:" + httpUrl + postUrl);
      } else {// 待扩展
       
      }
    } catch (Exception e) {
      log.error("发送http请求异常");
      log.error("httpurl:" + httpUrl);
      log.error("getUrl:" + getUrl);
      log.error("postUrl:" + postUrl);
      log.error(e.getMessage());
      resInfo.setErrMsgInfo("发送http请求异常,请查看执行日志记录");
      return resInfo;
    }

    // 存储执行结果和拼接的url
    return resInfo;
View Full Code Here

Examples of cn.baiweigang.qtaf.toolkit.httpclient.ResponseInfo

   * @param http url地址
   * @param posturl 参数键值对 格式key=value&key=value
   * @return ResponseInfo
   */
  public ResponseInfo ExecPostResquest(TreeMap<String, String> header,String http, String posturl) {
    ResponseInfo resInfo=new ResponseInfo();
    // 设置发起请求时使用的编码
    this.sendRequestCore.setCharset("UTF-8");
    try {
      // 发起请求
      resInfo= sendRequestCore.post(header, http, posturl);
      resInfo.setHttpUrl("post请求的url信息:" + http + "  post请求的body信息为-" + posturl);
    } catch (Exception e) {
      log.error("发送http请求失败,请检查");
      log.error(e.getMessage());
      resInfo.setErrMsgInfo("发送http请求失败,请检查");
      return resInfo;
    }
    return resInfo;
  }
View Full Code Here

Examples of cn.baiweigang.qtaf.toolkit.httpclient.ResponseInfo

   * @param header
   * @param gethttpurl get请求的url 包括参数键值对 ...?key=value&key=value
   * @return ResponseInfo
   */
  public ResponseInfo ExecGetResquest(TreeMap<String, String> header,String gethttpurl) {
    ResponseInfo resInfo=new ResponseInfo();
    // 设置发起请求时使用的编码
    this.sendRequestCore.setCharset("UTF-8");
    try {
      // 发起请求
      resInfo= sendRequestCore.get(header, gethttpurl);
      resInfo.setHttpUrl(gethttpurl);
    } catch (Exception e) {
      log.error("发送http请求" + gethttpurl + "失败,请检查");
      log.error(e.getMessage());
      resInfo.setErrMsgInfo("发送http请求" + gethttpurl + "失败,请检查");
      return resInfo;
    }
    return resInfo;
  }
View Full Code Here

Examples of cn.baiweigang.qtaf.toolkit.httpclient.ResponseInfo

   *
   * @param testCase
   * @return ResponseInfo
   */
  public ResponseInfo execResquest(IftTestCase testCase) {
    ResponseInfo resInfo=new ResponseInfo();
    // 设置发起请求时使用的编码
    log.info("发起请求使用的编码为:"+testCase.getEnCoding());
    this.httpUtil.setCharset(testCase.getEnCoding());
    // 获取发起请求的http地址
    if (!updateHttpUrl(testCase)) {
      log.error("发起http请求时,获取http地址失败");
      resInfo.setErrMsgInfo("发起http请求时,获取http地址失败");
      return resInfo;
    }
    // 获取发起请求的url参数信息
    if (!updateUrlPara(testCase)) {
      log.error("发起http请求时,获取url参数信息失败");
      resInfo.setErrMsgInfo("发起http请求时,获取url参数信息失败");
      return resInfo;
    }
    // 获取发起请求的post参数信息
    if (!updateFormParaMap(testCase)) {
      log.error("发起http请求时,获取post参数信息失败");
      resInfo.setErrMsgInfo("发起http请求时,获取post参数信息失败");
      return resInfo;
    }
    // 获取发起请求的headers信息
    if (!updateHeadersMap(testCase)) {
      log.error("发起http请求时,获取headers信息失败");
      resInfo.setErrMsgInfo("发起http请求时,获取headers信息失败");
      return resInfo;
    }
    try {
      // 发起请求
      if (testCase.getHttpMethod().equalsIgnoreCase("get")) {
        resInfo= httpUtil.get(headersMap, httpUrl + getUrl);
        resInfo.setHttpUrl(httpUrl + getUrl);
      } else if (testCase.getHttpMethod().equalsIgnoreCase("post")) {
        resInfo= httpUtil.post(headersMap, httpUrl+getUrl, postUrl);
        resInfo.setHttpUrl("post请求的url信息:" + httpUrl + postUrl);
      } else {// 待扩展
       
      }
    } catch (Exception e) {
      log.error("发送http请求异常");
      log.error("httpurl:" + httpUrl);
      log.error("getUrl:" + getUrl);
      log.error("postUrl:" + postUrl);
      log.error(e.getMessage());
      resInfo.setErrMsgInfo("发送http请求异常,请查看执行日志记录");
      return resInfo;
    }

    // 存储执行结果和拼接的url
    return resInfo;
View Full Code Here

Examples of cn.baiweigang.qtaf.toolkit.httpclient.ResponseInfo

   * @param http url地址
   * @param posturl 参数键值对 格式key=value&key=value
   * @return ResponseInfo
   */
  public ResponseInfo ExecPostResquest(TreeMap<String, String> header,String http, String posturl) {
    ResponseInfo resInfo=new ResponseInfo();
    // 设置发起请求时使用的编码
    this.httpUtil.setCharset("UTF-8");
    try {
      // 发起请求
      resInfo= httpUtil.post(header, http, posturl);
      resInfo.setHttpUrl("post请求的url信息:" + http + "  post请求的body信息为-" + posturl);
    } catch (Exception e) {
      log.error("发送http请求失败,请检查");
      log.error(e.getMessage());
      resInfo.setErrMsgInfo("发送http请求失败,请检查");
      return resInfo;
    }
    return resInfo;
  }
View Full Code Here

Examples of cn.baiweigang.qtaf.toolkit.httpclient.ResponseInfo

   * @param header
   * @param gethttpurl get请求的url 包括参数键值对 ...?key=value&key=value
   * @return ResponseInfo
   */
  public ResponseInfo ExecGetResquest(TreeMap<String, String> header,String gethttpurl) {
    ResponseInfo resInfo=new ResponseInfo();
    // 设置发起请求时使用的编码
    this.httpUtil.setCharset("UTF-8");
    try {
      // 发起请求
      resInfo= httpUtil.get(header, gethttpurl);
      resInfo.setHttpUrl(gethttpurl);
    } catch (Exception e) {
      log.error("发送http请求" + gethttpurl + "失败,请检查");
      log.error(e.getMessage());
      resInfo.setErrMsgInfo("发送http请求" + gethttpurl + "失败,请检查");
      return resInfo;
    }
    return resInfo;
  }
View Full Code Here

Examples of cn.baiweigang.qtaf.toolkit.httpclient.ResponseInfo

   *
   * @param testCase
   * @return ResponseInfo
   */
  public ResponseInfo execResquest(IftTestCase testCase) {
    ResponseInfo resInfo=new ResponseInfo();
    // 设置发起请求时使用的编码
    this.sendRequestCore.setCharset(testCase.getEnCoding());
    boolean flag = false;
    // 获取发起请求的http地址
    flag = this.updateHttpUrl(testCase);
    if (!flag) {
      log.info("发起http请求时,获取http地址失败");
      resInfo.setErrMsgInfo("发起http请求时,获取http地址失败");
      return resInfo;
    }
    // 获取发起请求的url参数信息
    flag = this.updateUrlPara(testCase);
    if (!flag) {
      log.info("发起http请求时,获取url参数信息失败");
      resInfo.setErrMsgInfo("发起http请求时,获取url参数信息失败");
      return resInfo;
    }
    // 获取发起请求的post参数信息
    flag = updateFormParaMap(testCase);
    if (!flag) {
      log.info("发起http请求时,获取post参数信息失败");
      resInfo.setErrMsgInfo("发起http请求时,获取post参数信息失败");
      return resInfo;
    }
    // 获取发起请求的headers信息
    flag = updateHeadersMap(testCase);
    if (!flag) {
      log.info("发起http请求时,获取headers信息失败");
      resInfo.setErrMsgInfo("发起http请求时,获取headers信息失败");
      return resInfo;
    }
    try {
      // 发起请求
      if (testCase.getHttpMethod().toLowerCase().equals("get")) {
        resInfo= sendRequestCore.get(headersMap, httpUrl + getUrl);
        resInfo.setHttpUrl(httpUrl + getUrl);
      } else if (testCase.getHttpMethod().toLowerCase().equals("post")) {
        resInfo= sendRequestCore.post(headersMap, httpUrl+getUrl, postUrl);
        resInfo.setHttpUrl("post请求的url信息:" + httpUrl + postUrl);
      } else {// 待扩展
       
      }
    } catch (Exception e) {
      log.error("发送http请求异常");
      log.error("httpurl:" + httpUrl);
      log.error("getUrl:" + getUrl);
      log.error("postUrl:" + postUrl);
      log.error(e.getMessage());
      resInfo.setErrMsgInfo("发送http请求异常,请查看执行日志记录");
      return resInfo;
    }

    // 存储执行结果和拼接的url
    return resInfo;
View Full Code Here

Examples of cn.baiweigang.qtaf.toolkit.httpclient.ResponseInfo

   * @param http url地址
   * @param posturl 参数键值对 格式key=value&key=value
   * @return ResponseInfo
   */
  public ResponseInfo ExecPostResquest(TreeMap<String, String> header,String http, String posturl) {
    ResponseInfo resInfo=new ResponseInfo();
    // 设置发起请求时使用的编码
    this.sendRequestCore.setCharset("UTF-8");
    try {
      // 发起请求
      resInfo= sendRequestCore.post(header, http, posturl);
      resInfo.setHttpUrl("post请求的url信息:" + http + "  post请求的body信息为-" + posturl);
    } catch (Exception e) {
      log.error("发送http请求失败,请检查");
      log.error(e.getMessage());
      resInfo.setErrMsgInfo("发送http请求失败,请检查");
      return resInfo;
    }
    return resInfo;
  }
View Full Code Here

Examples of cn.baiweigang.qtaf.toolkit.httpclient.ResponseInfo

   * @param header
   * @param gethttpurl get请求的url 包括参数键值对 ...?key=value&key=value
   * @return ResponseInfo
   */
  public ResponseInfo ExecGetResquest(TreeMap<String, String> header,String gethttpurl) {
    ResponseInfo resInfo=new ResponseInfo();
    // 设置发起请求时使用的编码
    this.sendRequestCore.setCharset("UTF-8");
    try {
      // 发起请求
      resInfo= sendRequestCore.get(header, gethttpurl);
      resInfo.setHttpUrl(gethttpurl);
    } catch (Exception e) {
      log.error("发送http请求" + gethttpurl + "失败,请检查");
      log.error(e.getMessage());
      resInfo.setErrMsgInfo("发送http请求" + gethttpurl + "失败,请检查");
      return resInfo;
    }
    return resInfo;
  }
View Full Code Here

Examples of com.esri.gpt.framework.http.ResponseInfo

        new ContentHandler() {
       
          @Override
          public boolean onBeforeReadResponse(HttpClientRequest request) {
            AgpDPart oThis = AgpDPart.this;
            ResponseInfo info = request.getResponseInfo();
            Header h;
            String s;
            s = "responseContentLength "+info.getContentLength();
            AgpDPart.LOGGER.finest("onBeforeReadResponse "+s);
           
            h = info.getResponseHeader("Content-Type");
            if (h != null) {
              HeaderElement elements[] = h.getElements();
              // Expect only one header element to be there, no more, no less
              if (elements.length == 1) {
                String sContentType = elements[0].getName();
                String sCharset = null;
                NameValuePair nvp = elements[0].getParameterByName("charset");
                if (nvp != null) {
                  sCharset = nvp.getValue();
                }
                oThis.setContentType(sContentType);
                oThis.setCharset(sCharset);
                s = "contentType="+sContentType+" charset="+sCharset;
                AgpDPart.LOGGER.finest("onBeforeReadResponse "+s);
              }
            }
           
            h = info.getResponseHeader("Content-Disposition");
            if (h != null) {
              HeaderElement elements[] = h.getElements();
              for (HeaderElement element: elements) {
                NameValuePair[] params = element.getParameters();
                for (NameValuePair param: params) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.