Package com.esri.gpt.framework.http

Examples of com.esri.gpt.framework.http.HttpClientRequest


    state = Val.chkStr(state);
    zip = Val.chkStr(zip);

    String requestUrl = this.makeQueryUrl(address, city, state, zip);

    HttpClientRequest client = HttpClientRequest.newRequest();
    client.setUrl(requestUrl);
    String sResponse = Val.chkStr(client.readResponseAsCharacters());

    if (sResponse.length() > 0) {
      try {

        JSONObject jso = new JSONObject(sResponse);
View Full Code Here


* @param requestContext request context
* @return processing context
*/
private ProcessingContext newProcessingContext(RequestContext requestContext) {
  Publisher publisher = null;
  HttpClientRequest httpClient = HttpClientRequest.newRequest();
  ProcessingContext processingContext = new ProcessingContext(requestContext, publisher, httpClient, null, false);

  FacesContextBroker contextBroker = new FacesContextBroker();
  MessageBroker msgBroker = contextBroker.extractMessageBroker();
  processingContext.setMessageBroker(msgBroker);
View Full Code Here

  }

  @Override
  public boolean checkConnection(IMessageCollector mb) {
    try {
      HttpClientRequest httpRequest = new HttpClientRequest();
      httpRequest.setUrl(protocol.getSourceHost());
      httpRequest.setContentHandler(new StringHandler());
      httpRequest.execute();
      return true;
    } catch (IOException ex) {
      mb.addErrorMessage("catalog.harvest.manage.test.err.HarvestConnectionException");
    }
    return false;
View Full Code Here

  }

  @Override
  public boolean checkConnection(IMessageCollector mb) {
    try {
      HttpClientRequest httpRequest = new HttpClientRequest();
      httpRequest.setUrl(url);
      httpRequest.setCredentialProvider(getCredentialProvider());
      httpRequest.setContentHandler(new StringHandler());
      httpRequest.execute();
      return true;
    } catch (IOException ex) {
      mb.addErrorMessage("catalog.harvest.manage.test.err.HarvestConnectionException");
    }
    return false;
View Full Code Here

    params.append("f=").append("json");
    params.append("&geometries=").append(enc(geometries));
    params.append("&inSR=").append(inSR);
    params.append("&outSR=").append(outSR);
   
    HttpClientRequest request = new HttpClientRequest();
    request.setUrl(geometryServiceURL+"/project?"+params);
    StringHandler handler = new StringHandler();
    request.setContentHandler(handler);
    request.execute();

    JSONObject response = new JSONObject(handler.getContent());
    if (response.has("error")) {
      JSONObject error = response.getJSONObject("error");
      int code = error.getInt("code");
View Full Code Here

  }
// methods =====================================================================

  @Override
  public void ping(String url) throws Exception {
    HttpClientRequest httpRequest = new HttpClientRequest();
    httpRequest.setUrl(url);
    httpRequest.setCredentialProvider(getCredentialProvider());
    httpRequest.setContentHandler(new StringHandler());
    httpRequest.execute();
  }
View Full Code Here

      if (Thread.currentThread().isInterrupted()) return;
     
      // process services on the ArcGIS server
      StringBuilder sbSummary = new StringBuilder();
      Publisher publisher = Publisher.makeSystemAdministrator(rContext);
      HttpClientRequest httpClient = HttpClientRequest.newRequest();
     
      ProcessingContext pContext = new ProcessingContext(rContext,publisher,httpClient,template,false);
      AGSProcessor ags = new AGSProcessor(pContext);
      ags.getTarget().setRestUrl(restUrl);
      ags.getTarget().setSoapUrl(soapUrl);
View Full Code Here

      URL url = null;
      Exception ex = null;
      try {
        url = new URL(record.getMetadataResourceURL());

        HttpClientRequest clientRequest = HttpClientRequest.newRequest(
            HttpClientRequest.MethodName.GET, url.toExternalForm());
        // clientRequest.setConnectionTimeOut(getConnectionTimeout());
        //clientRequest.setResponseTimeOut(getResponseTimeout());
        clientRequest.execute();
        String response = clientRequest.readResponseAsCharacters();
        LOG.finer("Response from get Metadata url = " + url.toExternalForm()
            +"\n response = \n"+ response);
        record.setFullMetadata(response);
      } catch (MalformedURLException e) {
        ex = e;
View Full Code Here

        FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_WARN,sExplicitPath,null);
        msgBroker.addMessage(fm);
       
        sFileName = sExplicitPath;
        Publisher publisher = getSelectablePublishers().selectedAsPublisher(context,false);
        HttpClientRequest httpClient = HttpClientRequest.newRequest();
       
        ProcessingContext pContext = new ProcessingContext(context,publisher,httpClient,null,bValidateOnly);
        pContext.setMessageBroker(msgBroker);
        ProcessorFactory factory = new ProcessorFactory();
        ResourceProcessor processor = factory.interrogate(pContext,sExplicitPath);
View Full Code Here

* @throws IOException if advancing fails
*/
private void advanceToNextRecords() throws IOException {
  LOGGER.finer("Advancing to the next group of records.");
  try {
    HttpClientRequest cr = new HttpClientRequest()
    cr.setUrl(info.newUrl(startIndex, itemsPerPage));
    XmlHandler sh = new XmlHandler(true);
    cr.setContentHandler(sh);
    cr.setCredentialProvider(info.newCredentialProvider());
    try{
      cr.execute();
    }catch (HttpClientException hcex){
      if(hcex.getHttpStatusCode() == 404){       
        cr.setUrl(info.newUrl(-1, -1));
          sh = new XmlHandler(true);
          cr.setContentHandler(sh);
          cr.setCredentialProvider(info.newCredentialProvider());
          cr.execute();
          noMore = true;
      }
    }
    Document doc = sh.getDocument();
    XPath xPath = XPathFactory.newInstance().newXPath();
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.http.HttpClientRequest

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.