• httpput


    String doHttpPut(String rpmName, String cookie) throws UnsupportedEncodingException, IOException, ClientProtocolException, Exception {
    HttpPut httpPut = new HttpPut(postURI);

    System.out.println("**********************");
    httpPut.setHeader("Cookie", cookie);
    httpPut.setHeader("Content-Type", "application/json;charset=UTF-8");
    httpPut.setEntity(getParamaters(rpmName));

    HttpResponse response = getHttpClient().execute(httpPut);
    HttpEntity entity = response.getEntity();
    String html = EntityUtils.toString(entity);
    return html;
    }

    private StringEntity getParamaters(String rpmName) throws UnsupportedEncodingException {

    String componentName = getComName(rpmName);

    JSONObject parms = new JSONObject();

    parms.put("ffff", componentName);

    noChange(parms);

    JSONObject subParams = new JSONObject();
    subParams.put("ss", componentName);

    parms.put("properties", subParams);

    String jsonString = parms.toString();
    System.out.println(jsonString);

    return new StringEntity(jsonString, ContentType.APPLICATION_JSON);
    }

  • 相关阅读:
    Visual Studio Code的常用快捷键
    requests模块
    爬虫基本原理
    Django-分页、中间件和请求的声明周期
    Django-admin管理工具
    Django-form表单
    Django-认证系统
    cookie、session和token
    Ajax
    Django进阶Model篇—数据库操作(ORM)
  • 原文地址:https://www.cnblogs.com/wblade/p/6528809.html
Copyright © 2020-2023  润新知