コード例 #1
0
  @Override
  public HttpRequestBase toHttpMethod(MushikagoAuth auth, ConnectInfo ci) throws RequestException {

    try {
      TreeMap<String, String> requestParams = new TreeMap<String, String>();
      if (null == this.domainName) throw new RequestException("ドメイン名を指定してください");
      requestParams.put(PARAM_KEY_DOMAIN_NAME, ParamUtils.paramEncode(this.domainName));
      if (null == this.collocationId) throw new RequestException("共起グラフIDを指定してください");
      requestParams.put(PARAM_KEY_COLLOCATION_ID, this.collocationId);
      requestParams.put(PARAM_KEY_LIMIT, ParamUtils.paramEncode(String.valueOf(this.limit)));
      requestParams.put(PARAM_KEY_OFFSET, ParamUtils.paramEncode(String.valueOf(this.offset)));
      if (null != this.filter)
        requestParams.put(PARAM_KEY_FILTER, ParamUtils.paramEncode(String.valueOf(this.filter)));
      return this.toHttpGetMethod(
          auth, ci, this.path(this.serviceName, this.categoryName, OPERATION_NAME), requestParams);
    } catch (UnsupportedEncodingException e) {
      throw new RequestException(e.getMessage());
    }
  }
コード例 #2
0
  @Override
  public HttpRequestBase toHttpMethod(MushikagoAuth auth, ConnectInfo ci) throws RequestException {

    try {
      TreeMap<String, String> requestParams = new TreeMap<String, String>();
      requestParams.put("id", ParamUtils.paramEncode(this.id));

      String url = this.makeRequestUrl(auth, ci, "DELETE", "/1/tombo/delete.json", requestParams);
      String getParamString = ParamUtils.mapToString(requestParams);
      if ("" != getParamString) {
        url = String.format("%s&%s", url, getParamString);
      }
      System.out.println(url);
      return new HttpDelete(url);
    } catch (UnsupportedEncodingException e) {
      throw new RequestException(e.getMessage());
    } catch (AuthException e) {
      throw new RequestException(e.getMessage());
    }
  }