Package com.esri.gpt.framework.http

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


  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(
        "/feed/entry",
        doc, XPathConstants.NODE);
    Node elementNode = null;
View Full Code Here


   */
  private String read(BaseAtomInfo info,String url) throws IOException {
    try {
      HttpClientRequest cr = new HttpClientRequest();
      cr.setUrl(url);
      XmlHandler sh = new XmlHandler(false);
      cr.setContentHandler(sh);
      cr.setCredentialProvider(info.newCredentialProvider());
      cr.setBatchHttpClient(info.getBatchHttpClient());
      try {
        cr.execute();
      } catch (IOException e) {
        return "";
      }     
      Document doc = sh.getDocument();     
      String mdText = XmlIoUtil.domToString(doc);
      return mdText;
    } catch (TransformerException ex) {
      throw new IOException("Error accessing metadata. Cause: "+ex.getMessage());
    }
View Full Code Here

  private String read(BaseAtomInfo info, String sourceUri) throws IOException {
    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(
          "/feed/entry",
          doc, XPathConstants.NODE);
      Node elementNode = null;
View Full Code Here

    InputStream wrappedStream = null;
    try {

      HttpClientRequest cr = new HttpClientRequest();
      cr.setUrl(url);
      XmlHandler sh = new XmlHandler(false);
      cr.setContentHandler(sh);
      cr.setCredentialProvider(cp != null ? cp : CredentialProvider.getThreadLocalInstance());
      cr.execute();

      return sh.getDocument();
    } catch (IllegalArgumentException ex) {
      LogUtil.getLogger().log(Level.FINER, "Error accessing host: " + url, ex);
      return null;
    } catch (IOException ex) {
      LogUtil.getLogger().log(Level.FINER, "Error accessing host: " + url, ex);
View Full Code Here

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

    boolean maxReached = false;
View Full Code Here

      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) {
        noMore = true;
        iterator = null;
View Full Code Here

  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);
    Node elementNode = null;
View Full Code Here

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();
    xPath.setNamespaceContext(makeNamespaceContext());
    NodeList entries = (NodeList) xPath.evaluate("/atom:feed/atom:entry", doc, XPathConstants.NODESET);

    String entryProcessorClassName = info.getEntryProcessorClassName();
View Full Code Here

TOP

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

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.