private String initPathParameter() { StringBuffer path = new StringBuffer(); StringBuffer slash = new StringBuffer("/"); path.append(PATH) .append(slash) .append(service) .append(slash) .append(returnType) .append(slash) .append(domain); if (method == GET || method == DELETE) { StringBuffer toAppend = new StringBuffer(); for (ParameterEntry<String, String> entry : parameters) { if (toAppend.length() == 0) { toAppend.append("?"); } else { toAppend.append("&"); } toAppend.append(entry.getKey()); toAppend.append("="); toAppend.append(entry.getValue()); } path.append(toAppend); } return path.toString(); }
/** * To build query. * * @return building response */ public String buildBody() { StringBuffer body = new StringBuffer("{\"parameters\":[{"); for (ParameterEntry<String, String> entry : parameters) { body.append("\"" + entry.getKey() + "\"" + ":" + "\"" + entry.getValue() + "\","); } body.append("}]}"); return body.toString(); }