Package com.complexible.common.web

Examples of com.complexible.common.web.HttpResource


      }
    }
  }

  private Request createSPARQLQueryRequest(String theQuery) {
    HttpResource aRes = new HttpResourceImpl(mURL);

    Request aQueryRequest;

    // auto prefix queries w/ rdf and rdfs namespaces
    ParameterList aParams = new ParameterList()
        .add(PARAM_QUERY, theQuery);

    if (mUseGetForQueries) {
      aQueryRequest = aRes.initGet()
          .addHeader(HttpHeaders.Accept.getName(), TupleQueryResultFormat.SPARQL.getDefaultMIMEType())
          .setParameters(aParams);
    }
    else {
      aQueryRequest = aRes.initPost()
          .addHeader(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType())
          .addHeader(HttpHeaders.Accept.getName(), TupleQueryResultFormat.SPARQL.getDefaultMIMEType())
          .setBody(aParams.getURLEncoded());
    }
View Full Code Here


   * @inheritDoc
   */
  public Graph graphQuery(final String theQuery) throws QueryException {
    assertConnected();

    HttpResource aRes = new HttpResourceImpl(mURL);

    ParameterList aParams = new ParameterList()
        .add(PARAM_QUERY, theQuery);

    Request aQueryRequest;
    Response aResponse = null;
    try {

      if (mUseGetForQueries) {
        aQueryRequest = aRes.initGet()
            .addHeader(HttpHeaders.Accept.getName(), RDFFormat.TURTLE.getDefaultMIMEType())
            .setParameters(aParams);
      }
      else {
        aQueryRequest = aRes.initPost()
            .addHeader(HttpHeaders.ContentType.getName(), MimeTypes.FormUrlEncoded.getMimeType())
            .addHeader(HttpHeaders.Accept.getName(), RDFFormat.TURTLE.getDefaultMIMEType())
            .setBody(aParams.getURLEncoded());
      }

View Full Code Here

TOP

Related Classes of com.complexible.common.web.HttpResource

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.