private String readQueryString() throws IOException { InputStream stream = new URL(queryFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
private ModelAndView getUpdateNamespaceResult(HttpServletRequest request, String prefix) throws IOException, ClientHTTPException, ServerHTTPException { String namespace = IOUtil.readString(request.getReader()); namespace = namespace.trim(); if (namespace.length() == 0) { throw new ClientHTTPException(SC_BAD_REQUEST, "No namespace name found in request body"); } // FIXME: perform some sanity checks on the namespace string try { RepositoryConnection repositoryCon = RepositoryInterceptor.getRepositoryConnection(request); synchronized (repositoryCon) { repositoryCon.setNamespace(prefix, namespace); } } catch (RepositoryException e) { throw new ServerHTTPException("Repository error: " + e.getMessage(), e); } return new ModelAndView(EmptySuccessView.getInstance()); }