private JSONObject getJson(HttpServletRequest request, HttpServletResponse response) throws JSONException, ClassNotFoundException, FileNotFoundException, SQLException, IOException, ParseException {
FetchType type = getTypeInRequest(request);
FetchMethod method = getMethodInRequest(request);
String endpoint = request.getParameter(AutocompleteKeys.REQUEST_ENDPOINT); //can be null, in that case retrieve both methods
String partialCompletion = request.getParameter(AutocompleteKeys.REQUEST_QUERY); //can be null, in that case retrieve both methods
int maxResults = Integer.parseInt(request.getParameter(AutocompleteKeys.REQUEST_MAX_RESULTS));
return AutocompleteResponseCreator.create(request, response, getServletContext().getRealPath("/"), type, method, endpoint, partialCompletion, maxResults);