Package org.openxri

Examples of org.openxri.XRI


      log.debug("processProxyRequest - sXRI is null or empty");
      sendResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, HTTP_ERROR_CONTENT_TYPE, "INVALID_QXRI(code=211): null or empty", null);
      return;
    }

    XRI oXRI = null;
    try {
      oXRI = XRI.fromURINormalForm(qxri);
    }
    catch (XRIParseException oEx) {
      // log and send a 404
View Full Code Here


    store.close();
  }

  public void testCache() throws Exception {

    XRI xri;
    XRD xrd;

    // Let's say we want to resolve @free*earth*moon

    xri = new XRI("@free*earth*moon");
    GCSAuthority xriAuthority = (GCSAuthority) xri.getAuthorityPath();

    // We initialize the store by creating a root subsegment with an empty XRD (i.e. an entry point)

    SubSegment storeSubSegment = store.createRootSubSegment(xriAuthority.getGCSRoot(), new XRD());
    Authority storeAuthority = store.getSubSegmentAuthority(storeSubSegment);

    // We iterate through all subsegments of the XRI that we were given to resolve.

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

      XRISubSegment subSegment = xriAuthority.getSubSegmentAt(i);

      // Somehow we obtain an XRD for this subsegment

      xrd = magicXriResolution(subSegment);

      // Now we cache the XRD we just got. We do this by creating a new subsegment in the store.

      storeSubSegment = store.registerSubsegment(storeAuthority, subSegment.toString(), xrd);
      storeAuthority = store.getSubSegmentAuthority(storeSubSegment);
    }

    // Let's say a while later we want to resolve @free*earth*moon again... We find it in the store, yay!!!

    xri = new XRI("@free*earth*moon");
    xriAuthority = (GCSAuthority) xri.getAuthorityPath();

    storeAuthority = store.localLookup(xriAuthority);
    assertNotNull(storeAuthority);

    xrd = storeAuthority.getXrd();
View Full Code Here

    private void checkXRI(String sXRI, boolean bAbsolute)
    {
        XRIReference oXRI = null;
        if (bAbsolute)
        {
            oXRI = new XRI(sXRI);
        }
        else
        {
            oXRI = new RelativeXRI(sXRI);
        }
View Full Code Here

    */ /**
    *
    */
    private void checkXRIAsURI(String sXRI, String sURI)
    {
        XRI oXRI = new XRI(sXRI);
        String sGenURI = oXRI.toURINormalForm();
        if (!sGenURI.equals(sURI))
        {
            throw new RuntimeException(
                "Parsed xri \"" + oXRI.toString() +
                "\" did not match expected URI serialization \"" + sURI + "\"" +
                ", got \"" + sGenURI + "\"");
        }

    }
View Full Code Here

        boolean bAbsolute)
    {
        XRIReference oXRI = null;
        if (bAbsolute)
        {
            oXRI = new XRI(sXRI);
        }
        else
        {
            oXRI = new RelativeXRI(sXRI);
        }
View Full Code Here

      }
    }
   
    String[] httpsBypassAuthorities = this.config.getHttpsBypassAuthorities();
    for (int i = 0; i < httpsBypassAuthorities.length; i++) {
      XRI x = XRI.fromURINormalForm(httpsBypassAuthorities[i]);
      this.resolver.addHttpsBypassAuthority(httpsBypassAuthorities[i]);
    }
   
    this.rootRedirect = this.config.getRootRedirect();
    this.bareXRINotFoundRedirect = this.config.getBareXRINotFoundRedirect();
View Full Code Here

      log.debug("processProxyRequest - sXRI is null or empty");
      sendResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, HTTP_ERROR_CONTENT_TYPE, "INVALID_QXRI(code=211): null or empty", null);
      return;
    }

    XRI oXRI = null;
    try {
      oXRI = XRI.fromURINormalForm(qxri);
    }
    catch (XRIParseException oEx) {
      // log and send a 404
View Full Code Here

      }
    }

    String[] httpsBypassAuthorities = this.config.getHttpsBypassAuthorities();
    for (int i = 0; i < httpsBypassAuthorities.length; i++) {
      XRI x = XRI.fromURINormalForm(httpsBypassAuthorities[i]);
      this.resolver.addHttpsBypassAuthority(httpsBypassAuthorities[i]);
    }

    String[] samlBypassAuthorities = this.config.getSamlBypassAuthorities();
    for (int i = 0; i < samlBypassAuthorities.length; i++) {
      XRI x = XRI.fromURINormalForm(samlBypassAuthorities[i]);
      this.resolver.addSAMLBypassAuthority(samlBypassAuthorities[i]);
    }

    if (this.config.getUseCache()) {
      this.resolver.setCache(new ResolverCache());
View Full Code Here

      log.debug("processProxyRequest - sXRI is null or empty");
      sendError(request, response, null, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, 211, "INVALID_QXRI(code=211): null or empty", null);
      return;
    }

    XRI oXRI = null;
    try {
      oXRI = XRI.fromURINormalForm(qxri);
    }
    catch (XRIParseException oEx) {
      // log and send a 404
View Full Code Here

    public XRDS resolveAuthToXRDS(String qxri, TrustType trustType, boolean followRefs, ResolverState state)
      throws PartialResolutionException
  {
    log.trace("resolveAuthToXRDS(s'" + qxri + "', trustType=" + trustType + ", followRefs=" + followRefs + ")");
    XRI xri = parseAbsoluteQXRIOrError(qxri);     
    return resolveAuthToXRDS(xri, trustType, followRefs, state);
  }
View Full Code Here

TOP

Related Classes of org.openxri.XRI

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.