public String getAdminURL() { return getBaseURL().replace("/collection1", ""); }
/** * Processes a DELETE request using a URL path (with no context path) + optional query params, * e.g. "/schema/analysis/protwords/english", and returns the response content. * * @param request the URL path and optional query params * @return The response to the DELETE request */ public String delete(String request) throws IOException { HttpDelete httpDelete = new HttpDelete(getBaseURL() + request); return getResponse(httpDelete); }
/** * Processes a "query" using a URL path (with no context path) + optional query params, * e.g. "/schema/fields?indent=off" * * @param request the URL path and optional query params * @return The response to the query * @exception Exception any exception in the response. */ public String query(String request) throws Exception { return getResponse(new HttpGet(getBaseURL() + request)); }
/** * Processes a PUT request using a URL path (with no context path) + optional query params, * e.g. "/schema/fields/newfield", PUTs the given content, and returns the response content. * * @param request The URL path and optional query params * @param content The content to include with the PUT request * @return The response to the PUT request */ public String put(String request, String content) throws IOException { HttpPut httpPut = new HttpPut(getBaseURL() + request); httpPut.setEntity(new StringEntity(content, ContentType.create( "application/json", StandardCharsets.UTF_8))); return getResponse(httpPut); }
/** * Processes a POST request using a URL path (with no context path) + optional query params, * e.g. "/schema/fields/newfield", PUTs the given content, and returns the response content. * * @param request The URL path and optional query params * @param content The content to include with the POST request * @return The response to the POST request */ public String post(String request, String content) throws IOException { HttpPost httpPost = new HttpPost(getBaseURL() + request); httpPost.setEntity(new StringEntity(content, ContentType.create( "application/json", StandardCharsets.UTF_8))); return getResponse(httpPost); }