final String contentType = response.getContentType(); parser.parse(response.getInputStream(), new DefaultHandler2() { response.abort();
private String doGET(final String url) throws Exception { JettyResponseListener response = null; try { final ConnectOptions opts = new ConnectOptions(url); opts.method = "GET"; response = m_repo.doConnect(opts); RemoteRepository.checkResponseCode(response); return response.getResponseBody(); } finally { if (response != null) response.abort(); } }
throws IOException { final int rc = responseListener.getStatus(); + responseListener.getReason() + ", Response=" + responseListener.getResponseBody()); log.debug("Status Line: " + responseListener.getReason());
/** * Throw an exception if the status code does not indicate success. * * @param response * The response. * * @return The response. * * @throws IOException */ private static JettyResponseListener checkResponseCode(final String url, final JettyResponseListener response) throws IOException { final int rc = response.getStatus(); if (rc < 200 || rc >= 300) { throw new HttpException(rc, "StatusCode=" + rc + ", StatusLine=" + response.getReason() + ", headers=" + response.getHeaders().toString() + ", ResponseBody=" + response.getResponseBody()); } if (log.isDebugEnabled()) { /* * write out the status list, headers, etc. */ log.debug("*** Response ***"); log.debug("Status Line: " + response.getReason()); } return response; }
final String contentEncoding = getContentEncoding(); if (contentEncoding != null ) { r = new InputStreamReader(getInputStream(), contentEncoding); } else if (getContentType()!=null && getContentType().startsWith("text/")) { r = new InputStreamReader(getInputStream(),ISO_8859_1); } else { r = new InputStreamReader(getInputStream());
final String contentType = response.getContentType(); throw new IOException( "Could not identify format for service response: serviceURI=" + sparqlEndpointURL + ", contentType=" + contentType + " : response=" + response.getResponseBody()); final Properties properties = parser.parse(response.getInputStream()); response.abort();
/** * Abort the request/response. The request is associated with the http * request/response is aborted. If we already have the response, then it's * {@link InputStream} is closed. */ public void abort() { // Note: jetty requires a cause for request.abort(Throwable). abort(new IOException()); }
final JettyResponseListener listener = new JettyResponseListener( request, TimeUnit.SECONDS.toMillis(300));
/** * Checks whether the mapgraph runtime is available. * @return */ public boolean mapgraphRuntimeAvailable() throws Exception { final String repositoryUrl = getSparqlEndpointUrlForNamespaceOrDefault(null /* default namespace */); /** * First reset the runtime */ final ConnectOptions opts = newConnectOptions(repositoryUrl, UUID.randomUUID(), null/* tx */); JettyResponseListener response = null; // Setup the request entity. { opts.addRequestParam(MAPGRAPH, MAPGRAPH_CHECK_RUNTIME_AVAILABLE); opts.method = "POST"; } try { response = doConnect(opts); return response.getStatus()==200 /* HTTP OK */; } finally { if (response != null) response.abort(); } }
log.info(response.getResponseBody()); log.info(response.getResponseBody());
final String contentType = response.getContentType(); throw new IOException( "Could not identify format for service response: serviceURI=" + opts.getBestRequestURL() + ", contentType=" + contentType + " : response=" + response.getResponseBody()); final InputStream is = response.getInputStream(); try { result = parser.parse(is); response.abort();
response.abort();
/** * Throw an exception if the status code does not indicate success. * * @param response * The response. * * @return The response. * * @throws IOException */ private static JettyResponseListener checkResponseCode(final String url, final JettyResponseListener response) throws IOException { final int rc = response.getStatus(); if (rc < 200 || rc >= 300) { throw new HttpException(rc, "StatusCode=" + rc + ", StatusLine=" + response.getReason() + ", headers=" + response.getHeaders().toString() + ", ResponseBody=" + response.getResponseBody()); } if (log.isDebugEnabled()) { /* * write out the status list, headers, etc. */ log.debug("*** Response ***"); log.debug("Status Line: " + response.getReason()); } return response; }
final JettyResponseListener listener = new JettyResponseListener( request, TimeUnit.SECONDS.toMillis(300));
final String contentType = response.getContentType(); throw new IOException( "Could not identify format for service response: serviceURI=" + sparqlEndpointURL + ", contentType=" + contentType + " : response=" + response.getResponseBody()); final Properties preparedProperties = parser.parse(response.getInputStream()); response.abort();
final String contentType = response.getContentType(); parser.parse(response.getInputStream(), new DefaultHandler2(){ response.abort();
private String doGET(final String url) throws Exception { JettyResponseListener response = null; final ConnectOptions opts = new ConnectOptions(url); opts.method = "GET"; response = doConnect(opts); try { checkResponseCode(url, response); return response.getResponseBody(); } finally { if (response != null) response.abort(); } }
/** * <code>LIST-TX</code>: Return the set of active transactions. */ public Iterator<IRemoteTxState0> listTx() { final ConnectOptions opts = new ConnectOptions(mgr.getBaseServiceURL() + "/tx"); opts.method = "GET"; JettyResponseListener response = null; try { RemoteRepository.checkResponseCode(response = mgr.doConnect(opts)); // Note: iterator return supports streaming results (not implemented). return multiTxResponse(response).iterator(); } catch (Exception e) { throw new RuntimeException(e); } finally { if (response != null) response.abort(); } }