Examples of PartialResolutionException


Examples of org.openxri.resolve.exception.PartialResolutionException

    {
      try {
        XRI xri = new XRI(qxri);
        if (xri.isRelative()) {
          XRD err = createErrorXRD(qxri, Status.INVALID_QXRI, "QXRI is not absolute.");
          throw new PartialResolutionException(err);
        }
        return xri;
      }
      catch (XRIParseException e) {
      XRD err = createErrorXRD(qxri, Status.INVALID_QXRI, "QXRI parse error: " + e.getMessage());
      throw new PartialResolutionException(err);
      }
      catch (Exception e) {
      XRD err = createErrorXRD(qxri, Status.PERM_FAIL, "Unexpected error while parsing input: " + e.getMessage());
      throw new PartialResolutionException(err);
      }
  }
View Full Code Here

Examples of org.openxri.resolve.exception.PartialResolutionException

     
      log.debug("writing negative cache entry " + xriAuthority + ", cacheTTL = " + negativeCacheTTL);
      cache.put(xriAuthority, flags.isHttps(), flags.isSaml(), xrdsBuf, negativeCacheTTL);
    }
   
    throw new PartialResolutionException(xrdsOut);
  }
View Full Code Here

Examples of org.openxri.resolve.exception.PartialResolutionException

        xrdsOut.add(finalXRD);
      } else {
        finalXRD.setStatus(new Status(Status.LIMIT_EXCEEDED,
            "Maximum of authority resolution requests exceeded"));
      }
      throw new PartialResolutionException(xrdsOut);
    }
   
  }
View Full Code Here

Examples of org.openxri.resolve.exception.PartialResolutionException

  private PartialResolutionException
  makeResolutionException(XRDS targetXRDS, String query, String status, String message)
  {
    XRD x = createErrorXRD(query, status, message);
    targetXRDS.add(x);
    return new PartialResolutionException(targetXRDS);
  }
View Full Code Here

Examples of org.openxri.resolve.exception.PartialResolutionException

        }
        catch (PartialResolutionException e) {
          log.trace("got PRE: " + e.getPartialXRDS());
          log.trace("xrdsOut.n = " + xrdsOut.getNumChildren() + ", partialXRDS.n=" + e.getPartialXRDS().getNumChildren());
          xrdsOut.addAll(e.getPartialXRDS());
          throw new PartialResolutionException(xrdsOut);       
        }
      }

      //// add the subsegments
      xrdsOut.addAll(tmpXRDS);

      //// replace parent XRD
      parent = tmpXRDS.getFinalXRD();
     
      for (int k = 0; k < tmpXRDS.getNumChildren(); k++) {
        XRISubSegment subseg = remainingSegment.getSubSegmentAt(k);
        parentXRI = parentXRI + subseg;
      }
     
      remainingSegment = remainingSegment.getRemainder(tmpXRDS.getNumChildren());

      tmpXRDS = null;     
      try {
        if (parent.getNumRedirects() > 0) {
          log.debug("resolveAuthSegment - processing Redirect(s)");
          tmpXRDS = processRedirects(qxri, parent, currentFlags, state);
          xrdsOut.addAll(tmpXRDS);
          // replace parent
          parent = tmpXRDS.getFinalXRD();
        }
        else if (parent.getNumRefs() > 0) {
          if (!currentFlags.isRefs()) {
            throw makeResolutionException(
              xrdsOut,
              query,
              Status.REF_NOT_FOLLOWED,
              "Ref not followed");
          }
          log.debug("resolveAuthSegment - processing Ref(s)");
          tmpXRDS = processRefs(parent, currentFlags, state);
          xrdsOut.addAll(tmpXRDS);
          // replace parent
          parent = tmpXRDS.getFinalXRD();
        }       
      }
      catch (PartialResolutionException e) {
        xrdsOut.addAll(e.getPartialXRDS());
        log.debug("resolveAuthSegment - got PRE while processing Ref or Redirect");
        throw new PartialResolutionException(xrdsOut);
      }
    }
   
    log.debug("resolveAuthSegment - successfully resolved all subsegments");
    if (parent.getStatus().getCID().equals(Status.CID_VERIFIED)
View Full Code Here

Examples of org.openxri.resolve.exception.PartialResolutionException

        break;
      }
      catch (PartialResolutionException e) {
        xrdsOut.add(e.getPartialXRDS());
        if (!it.hasNext()) // last ref, throw the exception (otherwise, continue)
          throw new PartialResolutionException(xrdsOut);
      }
    }
    return xrdsOut;
  }
View Full Code Here

Examples of org.openxri.resolve.exception.PartialResolutionException

    xrd.setSelectedServices(selectedSvcs);
    if (selectedSvcs.size() == 0) {
      Status s = xrd.getStatus();
      s.setCode(Status.SEP_NOT_FOUND);
      s.setText("Requested service endpoint not found");
      throw new PartialResolutionException(xrdsOut);
    }

    // check if first Service has Redirect of Ref
    Service srv = (Service)selectedSvcs.get(0);
    if (srv.getNumRedirects() > 0) {
View Full Code Here

Examples of org.openxri.resolve.exception.PartialResolutionException

        xrdsOut.add(tmpXRDS);
       
        // fall through to continue to the next
      }
    }
    throw new PartialResolutionException(xrdsOut);
  }
View Full Code Here

Examples of org.openxri.resolve.exception.PartialResolutionException

      catch (PartialResolutionException e) {
        xrdsOut.add(e.getPartialXRDS());
        // fall through to continue to the next
      }
    }
    throw new PartialResolutionException(xrdsOut);
  }
View Full Code Here

Examples of org.openxri.resolve.exception.PartialResolutionException

     
      if (stat == null)
        throw makeResolutionException(xrdsOut, query, Status.INVALID_XRDS, "Missing ServerStatus or Status element in Redirect XRD");

      if (!stat.getCode().equals(Status.SUCCESS)) {
        throw new PartialResolutionException(xrdsOut);
      }

      // check the basic properties of the descriptor
      if (!xrd.isValid()) {       
        xrd.setStatus(new Status(Status.UNEXPECTED_RESPONSE, "XRD is not valid (stale?)"));
        throw new PartialResolutionException(xrdsOut);
      }
     
      String err = verifyRedirectXRD(xrd, parent);
      if (err != null) {
        xrd.setStatus(new Status(Status.REDIRECT_VERIFY_FAILED, err));
        throw new PartialResolutionException(xrdsOut);
      }
     
      // copy parent Status cid attribute if present
      stat.setCID(xrd.getCanonicalID() == null? Status.CID_ABSENT : parent.getStatus().getCID());
     
      // copy parent Status ceid attribute (without checking if present since it is supposed to be "off" for
      // non-final XRD, and we don't know whether this is a final XRD.)
      stat.setCEID(parent.getStatus().getCEID());
     
      try {
        if (xrd.getNumRedirects() > 0) {
          log.info("fetchRedirectXRDS - XRD at URI(" + uri + ") contains Redirect(s), following..");
          tmpXRDS = processRedirects(qxri, xrd, flags, state);
          xrdsOut.addAll(tmpXRDS);
        }
        else if (xrd.getNumRefs() > 0) {
          if (!flags.isRefs()) {
            throw makeResolutionException(
              xrdsOut,
              query,
              Status.REF_NOT_FOLLOWED,
              "Ref not followed");
          }
          log.info("fetchRedirectXRDS - XRD at URI(" + uri + ") contains Ref(s), following..");
          tmpXRDS = processRefs(xrd, flags, state);
          xrdsOut.addAll(tmpXRDS);
        }
      }
      catch (PartialResolutionException e) {
        xrdsOut.addAll(e.getPartialXRDS());
        throw new PartialResolutionException(xrdsOut);
      }

      return xrdsOut;
  }
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.