Package com.esri.gpt.framework.http

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


    String url = (String) xPath.evaluate("/METADATA/METADATA_DATASET/@url", doc, XPathConstants.STRING);
    LOGGER.finer("Reading metadata of id: \"" +sourceUri+ "\" through proxy: "+this+"; Received no metadata URL within METADATA response.");
    if (url.length()==0) return "";

    url = Val.chkStr(url).replaceAll("\\{", "%7B").replaceAll("\\}", "%7D");
    HttpClientRequest cr = new HttpClientRequest();
    cr.setUrl(url);

    StringHandler sh = new StringHandler();
    cr.setContentHandler(sh);

    cr.execute();

    String mdText = sh.getContent();
    LOGGER.finer("Received metadata of id: \"" +sourceUri+ "\" through proxy: "+this);
    LOGGER.finest(mdText);
    return mdText;
View Full Code Here


  }

  public Content readContent(String sourceUri) throws IOException {
    LOGGER.log(Level.FINER, "Reading metadata of source URI: \"{0}\" through proxy: {1}", new Object[]{sourceUri, this});
    sourceUri = Val.chkStr(sourceUri).replaceAll("\\{", "%7B").replaceAll("\\}", "%7D");
    HttpClientRequest cr = new HttpClientRequest();
    cr.setBatchHttpClient(this.info.getBatchHttpClient());
    cr.setUrl(sourceUri);
    BreakableStringHandler sh = new BreakableStringHandler(criteria != null ? criteria.getFromDate() : null);
    cr.setContentHandler(sh);
    cr.execute();
    String mdText = sh.getContent();
    LOGGER.log(Level.FINER, "Received metadata of source URI: \"{0}\" through proxy: {1}", new Object[]{sourceUri, this});
    LOGGER.finest(mdText);
    return new Content(sh.getLastModifiedDate(), mdText);
  }
View Full Code Here

  }

  public String read(String sourceUri) throws IOException {
    LOGGER.log(Level.FINER, "Reading metadata of source URI: \"{0}\" through proxy: {1}", new Object[]{sourceUri, this});
    sourceUri = Val.chkStr(sourceUri).replaceAll("\\{", "%7B").replaceAll("\\}", "%7D");
    HttpClientRequest cr = new HttpClientRequest();
    cr.setBatchHttpClient(this.info.getBatchHttpClient());
    cr.setUrl(sourceUri);
    StringHandler sh = new StringHandler();
    cr.setContentHandler(sh);
    cr.execute();
    String mdText = sh.getContent();
    LOGGER.log(Level.FINER, "Received metadata of source URI: \"{0}\" through proxy: {1}", new Object[]{sourceUri, this});
    LOGGER.finest(mdText);
    return mdText;
  }
View Full Code Here

*/
private void loadFolderContent() {
  try {
    LOGGER.log(Level.FINER, "Loading folder content of {0}", url);
   
    HttpClientRequest cr = new HttpClientRequest();
    cr.setUrl(url);
    StringHandler sh = new StringHandler();
    cr.setContentHandler(sh);
    cr.setCredentialProvider(info.newCredentialProvider());
    cr.setBatchHttpClient(info.getBatchHttpClient());
    cr.execute();
   
    iterator = parseResonse(sh.getContent()).iterator();

    LOGGER.log(Level.FINER, "Loading folder content of {0} completed.", url);
  } catch (Exception ex) {
View Full Code Here

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

  FacesContextBroker contextBroker = new FacesContextBroker();
  MessageBroker msgBroker = contextBroker.extractMessageBroker();
  processingContext.setMessageBroker(msgBroker);
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.newListIdsUrl(resumptionToken, criteria.getFromDate(), criteria.getToDate()));

    XmlHandler sh = new XmlHandler(false);
    cr.setContentHandler(sh);
    cr.setCredentialProvider(info.newCredentialProvider());
    cr.execute();
    Document doc = sh.getDocument();

    XPath xPath = XPathFactory.newInstance().newXPath();
    NodeList nodeList = (NodeList) xPath.evaluate("/OAI-PMH/ListIdentifiers/header", doc, XPathConstants.NODESET);

View Full Code Here

          } else {
            info.numInactive++;
          }
        } else {
          sUrl += "?action=isSynchronizerRunning";
          HttpClientRequest request = new HttpClientRequest();
          request.setConnectionTimeMs((int)parsePeriod(connectionTimeout, DEFAULT_CONNECTION_TIMEOUT).getValue());
          request.setResponseTimeOutMs((int)parsePeriod(responseTimeout, DEFAULT_RESPONSE_TIMEOUT).getValue());
          request.setUrl(sUrl);
          try {
            LOGGER.info("Checking: "+sUrl);
            String response = Val.chkStr(request.readResponseAsCharacters());
            LOGGER.info("Response from: "+sUrl+" ="+response);
            if (response.equalsIgnoreCase("true")) {
              info.numActive++;
            } else if (response.equalsIgnoreCase("false")) {
              info.numInactive++;
View Full Code Here

     */
    private void loadFolderContent() {
      try {
        LOGGER.log(Level.FINER, "Loading folder content of {0}", info.getUrl());

        HttpClientRequest cr = new HttpClientRequest();
        cr.setUrl(info.getUrl());
        XmlHandler sh = new XmlHandler(false);
        cr.setContentHandler(sh);
        cr.setBatchHttpClient(info.getBatchHttpClient());
        cr.execute();

        iterator = parseResponse(sh.getDocument()).iterator();

        LOGGER.log(Level.FINER, "Loading folder content of {0} completed.", info.getUrl());
      } catch (Exception ex) {
View Full Code Here

public String read(String sourceUri) throws IOException {
  LOGGER.finer("Reading metadata of source URI: \"" +sourceUri+ "\" through proxy: "+this);
  try {
    sourceUri = Val.chkStr(sourceUri).replaceAll("\\{", "%7B").replaceAll("\\}", "%7D");
    HttpClientRequest cr = new HttpClientRequest();
    cr.setUrl(info.newReadMetadataUrl(sourceUri));
    XmlHandler sh = new XmlHandler(false);
    cr.setContentHandler(sh);
    cr.setCredentialProvider(info.newCredentialProvider());
    cr.setBatchHttpClient(info.getBatchHttpClient());
    cr.execute();
    Document doc = sh.getDocument();
    XPath xPath = XPathFactory.newInstance().newXPath();
    Node node = (Node) xPath.evaluate(
        "/OAI-PMH/GetRecord/record/metadata",
        doc, XPathConstants.NODE);
View Full Code Here

    }

    public void run() {
      try {
        StringHandler sh = new StringHandler();
        HttpClientRequest request = new HttpClientRequest();

        request.setUrl(httpReqDef.getUrl());
        request.setContentProvider(httpReqDef.getContentProvider());
        request.setCredentialProvider(cp);
        request.setContentHandler(sh);

        request.execute();

        if (request.getResponseInfo().getResponseCode() == HttpURLConnection.HTTP_OK) {
          String strContent = Val.chkStr(sh.getContent());
          Document docContent = null;
          String contentType = Val.chkStr(request.getResponseInfo().getContentType());

          try {
            if (strContent.length() > 0 && (contentType.toLowerCase().contains("xml") || strContent.startsWith("<?xml"))) {
              docContent = DomUtil.makeDomFromString(Val.removeBOM(strContent), false);
            }
          } catch (Exception ex) {
            LOGGER.log(Level.FINER, "Error converting HTPP response into DOM.", ex);
          }

          array.onResponse(request.getResponseInfo(), strContent, docContent);
        }
      } catch (HttpClient401Exception ex) {
        onUnauthorizedException();
      } catch (IOException ex) {
        LOGGER.log(Level.FINER, "Error submiting HTTP request.", ex);
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.