Examples of XRISegment


Examples of org.openxri.XRISegment

      );
      xrdsOut.add(err);
      throw new PartialResolutionException(xrdsOut);
    }

    XRISegment segment = xriAuth.getXRISegment();

    // resolve segment (list of subsegments not including root) against root XRD
    return resolveAuthSegment(origQXRI, rootXRD, segment, flags, state);
  }
View Full Code Here

Examples of org.openxri.XRISegment

    CanonicalID parentCID = null;
    boolean authResComplete = false;
    ResolverFlags currentFlags = null; // this is only for overriding by HttpsBypassAuthority settings

    String parentXRI = ((XRIAuthority)qxri.getAuthorityPath()).getRootAuthority();
    XRISegment remainingSegment = segment;
   
    while (remainingSegment != null && remainingSegment.getNumSubSegments() > 0) {
      // clone flags
      currentFlags = new ResolverFlags(flags);
     
      // more subsegments to resolve
      String query = remainingSegment.getSubSegmentAt(0).toURINormalForm(true);

      log.debug("resolveAuthSegment - resolving subsegment '" + query + "'");
     
      checkMaxRequests(xrdsOut, query, state);
     
      // if HTTPS is requested and what we are resolving is allowed to bypass HTTPS, we turn off the HTTPS flag
      // for auth-res service selection
      if (currentFlags.isHttps() && isHttpsBypassAuthority(parentXRI)) {
        log.debug("Bypassing HTTPS for " + parentXRI);
        currentFlags.setHttps(false);
      }
     
      //// perform service selection
      String authResMediaType = Tags.CONTENT_TYPE_XRDS + ";" + currentFlags.getTrustParameters();
      List authResServices = selectServices(parent.getServices(), Tags.SERVICE_AUTH_RES, null, authResMediaType, currentFlags);
      if (authResServices.size() < 1) {
        log.debug("resolveAuthSegment - no authority resolution service found!");
        throw makeResolutionException(
          xrdsOut,
          query,
          Status.AUTH_RES_NOT_FOUND,
          "Authority Resolution Service Not Found"
        );
      }

      try {
        // retrieve XRDS documents for the given subsegment
        log.trace("resolveAuthSegment - fetching XRDS");
        tmpXRDS = fetchAuthXRDS(qxri, parent, authResServices, remainingSegment, currentFlags, state);
      }
      catch (PartialResolutionException e) {
        log.trace("got PRE: " + e.getPartialXRDS());
        log.trace("xrdsOut.n = " + xrdsOut.getNumChildren() + ", partialXRDS.n=" + e.getPartialXRDS().getNumChildren());
        xrdsOut.add(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)");
View Full Code Here

Examples of org.openxri.XRISegment

        {
            sendNotFound(oResp);
            return;
        }

        XRISegment oSegment = null;
        try
        {
            oSegment = new XRISegment(sSegment);
        }
        catch (XRIParseException oEx)
        {
            // log and send a 404
            soLog.warn("Invalid Resolution Segment '" + sSegment + "'.", oEx);
View Full Code Here

Examples of org.openxri.XRISegment

    // look at the input data the URI mapper gave us

    String namespace = data.getNS();
    String authorityId = data.getID();
    String resolveData = data.getResolveData();
    XRISegment segment = null;

    try {

      segment = new XRISegment(resolveData);
    } catch (XRIParseException ex) {

      soLog.warn("Invalid Segment '" + resolveData + "'.", ex);
      response.sendError(HttpServletResponse.SC_BAD_REQUEST);
      return;
View Full Code Here

Examples of org.openxri.XRISegment

    */ /**
    *
    */
    private void checkXRISegment(String sXRISegment)
    {
        XRISegment oXRISegment = new XRISegment(sXRISegment);
        String sTostring = oXRISegment.toString();

        if (
            (!sTostring.equals(sXRISegment)) &&
            (!sTostring.equals(XRI.RDELIM_S + sXRISegment)))
        {
            throw new RuntimeException(
                "Parsed xrisegment \"" + oXRISegment.toString() +
                "\" did not match original xrisegment \"" + sXRISegment);
        }

    } // checkXRISegment()
View Full Code Here

Examples of org.openxri.XRISegment

    */ /**
    *
    */
    public void testUtilMethods()
    {
        XRISegment oSegment = new XRISegment("!a!b!c!d");
        assertTrue(
            "Failed XRISegment::getRemainder",
            oSegment.getRemainder(0).toString().equals("!a!b!c!d"));
        assertTrue(
            "Failed XRISegment::getRemainder",
            oSegment.getRemainder(1).toString().equals("!b!c!d"));
        assertTrue(
            "Failed XRISegment::getRemainder",
            oSegment.getRemainder(2).toString().equals("!c!d"));
        assertTrue(
            "Failed XRISegment::getRemainder",
            oSegment.getRemainder(3).toString().equals("!d"));
        assertTrue(
            "Failed XRISegment::getRemainder", oSegment.getRemainder(4) == null);

        System.out.println("Utility methods tested successfully");

    } // testUtilMethods()
View Full Code Here

Examples of org.openxri.XRISegment

      ServerException ex2 = new ServerInternalException("Unsupported encoding in query: " + ex.getMessage(), ex);
      log.warn(ex2);
      throw ex2;
    }

    XRISegment segment = new XRISegment(utf8Query);

    for (int i=0; i<segment.getNumSubSegments(); i++) {

      String subSegmentName = segment.getSubSegmentAt(i).toString();

      try {

        // create a fresh XRD
View Full Code Here

Examples of org.openxri.XRISegment

    // look at the input data the URI mapper gave us

    String namespace = data.getNamespace();
    String authorityId = data.getId();
    String resolveData = data.getResolveData();
    XRISegment segment = null;

    try {

      segment = new XRISegment(resolveData);
    } catch (XRIParseException ex) {

      soLog.warn("Invalid Segment '" + resolveData + "'.", ex);
      response.sendError(HttpServletResponse.SC_BAD_REQUEST);
      return;
View Full Code Here

Examples of org.openxri.XRISegment

      );
      xrdsOut.add(err);
      throw new PartialResolutionException(xrdsOut);
    }

    XRISegment segment = xriAuth.getXRISegment();

    // resolve segment (list of subsegments not including root) against root XRD
    return resolveAuthSegment(origQXRI, rootXRD, segment, flags, state);
  }
View Full Code Here

Examples of org.openxri.XRISegment

    CanonicalID parentCID = null;
    boolean authResComplete = false;
    ResolverFlags currentFlags = null; // this is only for overriding by HttpsBypassAuthority settings

    String parentXRI = ((XRIAuthority)qxri.getAuthorityPath()).getRootAuthority();
    XRISegment remainingSegment = segment;
   
    while (remainingSegment != null && remainingSegment.getNumSubSegments() > 0) {
      // clone flags
      currentFlags = new ResolverFlags(flags);
     
      // more subsegments to resolve
      String query = remainingSegment.getSubSegmentAt(0).toURINormalForm(true);

      log.debug("resolveAuthSegment - resolving subsegment '" + query + "'");
     
      checkMaxRequests(xrdsOut, query, state);
     
      // if HTTPS is requested and what we are resolving is allowed to bypass HTTPS, we turn off the HTTPS flag
      // for auth-res service selection
      if (currentFlags.isHttps() && isHttpsBypassAuthority(parentXRI)) {
        log.debug("Bypassing HTTPS for " + parentXRI);
        currentFlags.setHttps(false);
      }
     
      //// perform service selection
      String authResMediaType = Tags.CONTENT_TYPE_XRDS + ";" + currentFlags.getTrustParameters();
      List authResServices = selectServices(parent.getServices(), Tags.SERVICE_AUTH_RES, null, authResMediaType, currentFlags);
      if (authResServices.size() < 1) {
        log.debug("resolveAuthSegment - no authority resolution service found!");
        throw makeResolutionException(
          xrdsOut,
          query,
          Status.AUTH_RES_NOT_FOUND,
          "Authority Resolution Service Not Found"
        );
      }

      try {
        // retrieve XRDS documents for the given subsegment
        log.trace("resolveAuthSegment - fetching XRDS");
        tmpXRDS = fetchAuthXRDS(qxri, parent, authResServices, remainingSegment, currentFlags, state);
      }
      catch (PartialResolutionException e) {
        log.trace("got PRE: " + e.getPartialXRDS());
        log.trace("xrdsOut.n = " + xrdsOut.getNumChildren() + ", partialXRDS.n=" + e.getPartialXRDS().getNumChildren());
        xrdsOut.add(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)");
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.