Package com.complexible.common.web

Examples of com.complexible.common.web.Request


  }

  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);
View Full Code Here


    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()) {
        throw responseToException(theQuery, aResponse);
      }
      else {
View Full Code Here

TOP

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

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.