示例#1
0
 public String getGetResult() {
   String webUrl = url;
   Collection<Parameter> c = parametersMap.values();
   Iterator<Parameter> it = c.iterator();
   for (; it.hasNext(); ) {
     if (webUrl.indexOf("?") == -1) webUrl += "?";
     else webUrl += "&";
     Parameter parameter = it.next();
     webUrl += parameter.getKey() + "=" + parameter.getValue();
   }
   String result = HttpClientUtil.GetUrlContent(url, encoding);
   DateUtils.PrintTimeGap(webUrl, start, new Date());
   return result;
 }
示例#2
0
  public String getPostResult() {
    String webUrl = url;
    List<Parameter> parameters = new ArrayList<Parameter>();

    Collection<Parameter> c = parametersMap.values();
    Iterator<Parameter> it = c.iterator();
    for (; it.hasNext(); ) {
      Parameter parameter = it.next();
      parameters.add(parameter);
    }
    System.out.println("JsonUtil = " + JsonUtil.Object2Json(parameters));
    String result = HttpClientUtil.PostUrlContent(url, parameters, encoding);

    String log = DateUtils.PrintTimeGap(webUrl, start, new Date());
    System.out.println(log);
    return result;
  }