Package com.complexible.common.web

Examples of com.complexible.common.web.ParameterList


    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());
    }

    return aQueryRequest;
  }
View Full Code Here


  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());
      }

      aResponse = aQueryRequest.execute();

      if (aResponse.hasErrorCode()) {
View Full Code Here

TOP

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

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.