Examples of readResponseAsCharacters()


Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

      HttpClientRequest client = new HttpClientRequest();
      client.setUrl(resourceUrl);
      client.setConnectionTimeMs(5000);
      client.setResponseTimeOutMs(10000);
      try {
        response = Val.chkStr(client.readResponseAsCharacters());
        if (client.getResponseInfo().getContentType().toLowerCase().contains(
            "xml")
            && response.length() > 0) {
          return response;
        }
View Full Code Here

Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

   
  } else {
    client.setMethodName(MethodName.GET);
  }

  String response = client.readResponseAsCharacters();
  LOG.finer(" CSW Response : " + response);
  return new ByteArrayInputStream(response.getBytes("UTF-8"));
 
}
View Full Code Here

Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

    cr.setUrl(url + "/search?q=" +params.getQuery()+ "&f=json&num=" +params.getNum()+ "&start=" + params.getStart());
    cr.execute();
   
    try {
      List<ESRI_ItemInformation> infos = new ArrayList<ESRI_ItemInformation>();
      String json = cr.readResponseAsCharacters();
      JSONObject jso = new JSONObject(json);
      String nextStart = jso.getString("nextStart");
      JSONArray records = jso.getJSONArray("results");
      for (int idx = 0; idx < records.length(); idx++) {
          JSONObject record = records.optJSONObject(idx);
View Full Code Here

Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

* @throws IOException
*/
public String makeResourceXmlFromResponse(String resourceUrl) throws IOException {
  HttpClientRequest client = new HttpClientRequest();
  client.setUrl(resourceUrl);
  String response = Val.chkStr(client.readResponseAsCharacters());
  if (client.getResponseInfo().getResponseCode()!=HttpURLConnection.HTTP_OK) {
    throw new IOException("Invalid response received: "+client.getResponseInfo().getResponseMessage());
  }
  return response;
}
View Full Code Here

Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

    }
    LOGGER.finer("Attempting to read ArcGIS Server JSON response for:\n"+restUrl);
   
    HttpClientRequest client = HttpClientRequest.newRequest();
    client.setUrl(restUrl);
    String sResponse = Val.chkStr(client.readResponseAsCharacters());
   
    // attempt to create a JSON object from the response
    if (sResponse.length() > 0) {
      JSONObject jso = new JSONObject(sResponse);
      this.wasJson = true;
View Full Code Here

Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

          xml = this.readAgsXml(this.systemId);
        } catch (Exception e) {
          if (this.wasJson) {
            throw e;
          } else {
            String result = client.readResponseAsCharacters();
            StringReader reader = new StringReader(result);
            StringWriter writer = new StringWriter();
            transform(new StreamSource(reader),new StreamResult(writer));
            xml = Val.chkStr(writer.toString());
          }
View Full Code Here

Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

          }
        }
       
      } else {
        try {
          String result = client.readResponseAsCharacters();
          StringReader reader = new StringReader(result);
          StringWriter writer = new StringWriter();
          transform(new StreamSource(reader),new StreamResult(writer));
          xml = Val.chkStr(writer.toString());
        } catch (TransformerException te) {
View Full Code Here

Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

    httpClient.setCredentialProvider(
      credentials==null || credentials.getUsername().length()==0 || credentials.getPassword().length()==0?
        null:
        new CredentialProvider(credentials.getUsername(),credentials.getPassword())
    );
    String response = Val.chkStr(httpClient.readResponseAsCharacters());
   
    if (response.length() > 0) {
     
      // first try ArcGIS Server
      boolean interrofgateAGS = true;
View Full Code Here

Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

      if ((nHttpResponseCode < 200) || (nHttpResponseCode > 299)) {
        throw new JSONException("Add item request failed: HTTP "
            + nHttpResponseCode);
      }

      String resp = httpClient.readResponseAsCharacters();
      if (resp.length() > 0) {
        JSONObject jsoResponse;
        try {
          jsoResponse = new JSONObject(resp);
        } catch (JSONException e) {
View Full Code Here

Examples of com.esri.gpt.framework.http.HttpClientRequest.readResponseAsCharacters()

    int nHttpResponseCode = httpClient.getResponseInfo().getResponseCode();
    if ((nHttpResponseCode < 200) || (nHttpResponseCode > 299)) {
      throw new IOException("Request failed: HTTP " + nHttpResponseCode);
    }

    String resp = httpClient.readResponseAsCharacters();
    JSONObject jsoToken = new JSONObject(resp);
    if (jsoToken.has("token")) {
      this.token = jsoToken.getString("token");
      this.publicationStatus = true;
    } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.