Package org.openrdf.http.client.connections

Examples of org.openrdf.http.client.connections.HTTPRequest


  }

  public void delete(String id)
    throws StoreException
  {
    HTTPRequest request = pool.slash(id).delete();
    try {
      execute(request);
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
    finally {
      request.release();
    }
  }
View Full Code Here


      public TupleResult call()
        throws Exception
      {
        try {
          HTTPRequest request = createRequest();
          request.acceptTupleQueryResult();
          execute(request);
          return request.getTupleQueryResult();
        }
        catch (NoCompatibleMediaType e) {
          throw new UnsupportedRDFormatException(e);
        }
      }
View Full Code Here

  }

  public void get(TupleQueryResultHandler handler)
    throws TupleQueryResultHandlerException, StoreException
  {
    HTTPRequest request = createRequest();

    try {
      request.acceptTupleQueryResult();
      execute(request);
      request.readTupleQueryResult(handler);
    }
    catch (NoCompatibleMediaType e) {
      throw new UnsupportedRDFormatException(e);
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
    catch (QueryResultParseException e) {
      throw new StoreException(e);
    }
    finally {
      request.release();
    }
  }
View Full Code Here

  }

  public Model get()
    throws StoreException
  {
    HTTPRequest request = pool.get();

    try {
      request.acceptRDF(false);
      execute(request);
      return request.readModel();
    }
    catch (NumberFormatException e) {
      throw new StoreException("Server responded with invalid size value");
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
    catch (RDFParseException e) {
      throw new StoreException(e);
    }
    catch (NoCompatibleMediaType e) {
      throw new StoreException(e);
    }
    finally {
      request.release();
    }
  }
View Full Code Here

   *------------------*/

  public String getQueryType(QueryLanguage ql, String query)
    throws StoreException, MalformedQueryException
  {
    HTTPRequest request = pool.head();

    try {
      request.acceptBoolean();
      request.acceptTupleQueryResult();
      request.acceptGraphQueryResult();
      request.sendForm(getQueryParams(ql, query, null, true));
      execute(request);
      return request.readQueryType();
    }
    catch (NoCompatibleMediaType e) {
      throw new UnsupportedRDFormatException(e);
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
    finally {
      request.release();
    }
  }
View Full Code Here

  public TupleResult sendTupleQuery(QueryLanguage ql, String query, Dataset dataset,
      boolean includeInferred, Binding... bindings)
    throws StoreException, MalformedQueryException
  {
    final HTTPRequest request = pool.post();
    request.sendForm(getQueryParams(ql, query, dataset, includeInferred, bindings));
    Callable<TupleResult> task = new Callable<TupleResult>() {

      public TupleResult call()
        throws Exception
      {
        try {
          request.acceptTupleQueryResult();
          execute(request);
          return request.getTupleQueryResult();
        }
        catch (NoCompatibleMediaType e) {
          throw new UnsupportedRDFormatException(e);
        }
      }
View Full Code Here

  public void sendTupleQuery(QueryLanguage ql, String query, Dataset dataset, boolean includeInferred,
      TupleQueryResultHandler handler, Binding... bindings)
    throws TupleQueryResultHandlerException, StoreException, MalformedQueryException
  {
    HTTPRequest request = pool.post();

    try {
      request.acceptTupleQueryResult();
      request.sendForm(getQueryParams(ql, query, dataset, includeInferred, bindings));
      execute(request);
      request.readTupleQueryResult(handler);
    }
    catch (NoCompatibleMediaType e) {
      throw new UnsupportedRDFormatException(e);
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
    catch (QueryResultParseException e) {
      throw new StoreException(e);
    }
    finally {
      request.release();
    }
  }
View Full Code Here

  public GraphResult sendGraphQuery(QueryLanguage ql, String query, Dataset dataset,
      boolean includeInferred, Binding... bindings)
    throws StoreException, MalformedQueryException
  {
    final HTTPRequest request = pool.post();
    request.sendForm(getQueryParams(ql, query, dataset, includeInferred, bindings));
    Callable<GraphResult> task = new Callable<GraphResult>() {

      public GraphResult call()
        throws Exception
      {
        try {
          request.acceptGraphQueryResult();
          execute(request);
          return request.getGraphQueryResult();
        }
        catch (NoCompatibleMediaType e) {
          throw new UnsupportedRDFormatException(e);
        }
      }
View Full Code Here

  public void sendGraphQuery(QueryLanguage ql, String query, Dataset dataset, boolean includeInferred,
      RDFHandler handler, Binding... bindings)
    throws RDFHandlerException, StoreException, MalformedQueryException
  {
    HTTPRequest request = pool.post();

    try {
      request.acceptRDF(false);
      request.sendForm(getQueryParams(ql, query, dataset, includeInferred, bindings));
      execute(request);
      request.readRDF(handler);
    }
    catch (NoCompatibleMediaType e) {
      throw new UnsupportedRDFormatException(e);
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
    catch (RDFParseException e) {
      throw new StoreException(e);
    }
    finally {
      request.release();
    }
  }
View Full Code Here

  public boolean sendBooleanQuery(QueryLanguage ql, String query, Dataset dataset, boolean includeInferred,
      Binding... bindings)
    throws StoreException, MalformedQueryException
  {
    HTTPRequest request = pool.post();

    try {
      request.acceptBoolean();
      request.sendForm(getQueryParams(ql, query, dataset, includeInferred, bindings));
      execute(request);
      return request.readBoolean();
    }
    catch (NoCompatibleMediaType e) {
      throw new UnsupportedRDFormatException(e);
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
    catch (QueryResultParseException e) {
      throw new StoreException(e);
    }
    finally {
      request.release();
    }
  }
View Full Code Here

TOP

Related Classes of org.openrdf.http.client.connections.HTTPRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.