Package org.openxri

Examples of org.openxri.XRI


    while (it.hasNext()) {
      Ref ref = (Ref)it.next();
 
      checkMaxRefs(xrdsOut, ref.getValue(), state);
 
      XRI refXRI;
      try {
        refXRI = parseAbsoluteQXRIOrError(ref.getValue());
      }
      catch (PartialResolutionException e) {
        xrdsOut.add(e.getPartialXRDS());
View Full Code Here


   * @return XRI
   */
  private XRI parseAbsoluteQXRIOrError(String qxri)
      throws 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;
View Full Code Here

    }
  }

  protected XRI parseAbsoluteXRI(String qxri) {
    try {
      XRI xri = new XRI(qxri);
      if (xri.isRelative()) {
        log.warn("parseAbsoluteXRI - '" + qxri + "' is not absolute!");
        return null;
      }
      return xri;
    } catch (XRIParseException e) {
View Full Code Here

    try {
      Resolver resolver = setupResolver();
      qxri = "@xrid*test*freeid*null-provider";
      qxri = "=les.chasen";
      qxri = "=kermit*\u65e5\u672c\u7248";
      XRI xri = XRI.fromIRINormalForm(qxri);
     
      ResolverFlags flags = new ResolverFlags();
      flags.setUric(true);
      flags.setHttps(false);
      resolver.resolveSEPToXRD(xri, null, null, flags, new ResolverState());
View Full Code Here

    String qxri;
   
    try {
      Resolver resolver = setupResolver();
      qxri = "@xrid*test*live.unit.tests*0003-badcid*kid";     
      XRI xri = XRI.fromIRINormalForm(qxri);
     
      ResolverFlags flags = new ResolverFlags();
      XRDS xrds = resolver.resolveAuthToXRDS(xri, flags, new ResolverState());
      // System.out.println(xrds);

View Full Code Here

  public void testLiveRef() {
    String qxri;
    try {
      Resolver resolver = setupResolver();
      qxri = "@xrid*test*live.unit.tests*0002-ref";
      XRI xri = XRI.fromIRINormalForm(qxri);
     
      ResolverFlags flags = new ResolverFlags();
      XRDS xrds = resolver.resolveAuthToXRDS(xri, flags, new ResolverState());
      assertTrue("There should be 5 child elements", xrds.getNumChildren() == 5);
      assertTrue("The last child should be an XRDS element because it followed a Ref", xrds.isXRDSAt(4));
View Full Code Here

 
  public void testLiveRedirect() {
    String qxri = "@xrid*test*live.unit.tests*0004-redirect/(+blog)";
    try {
      Resolver resolver = setupResolver();
      XRI xri = XRI.fromIRINormalForm(qxri);
     
      ResolverFlags flags = new ResolverFlags();
      XRDS xrds = resolver.resolveSEPToXRDS(xri, null, null, flags, new ResolverState());
      System.out.println(xrds);
      assertTrue("There should be 8 child elements", xrds.getNumChildren() == 8);
View Full Code Here

    String qxri = "xri://@a*b*c/d/e?f=g";

    try {
      URI sepURI = new URI("http://example.com/hello");
      String result = resolver.constructURI(sepURI, "local",
          new XRI(qxri));
      assertTrue("Invalid constructed URI for append=local '" + result
          + "'", result.equals(sepURI.toString() + "/d/e?f=g"));
      result = resolver.constructURI(sepURI, "qxri", new XRI(qxri));
      assertTrue("Invalid constructed URI for append=qxri '" + result
          + "'", result.equals(sepURI.toString() + "@a*b*c/d/e?f=g"));
      System.out.println("result = " + result);
    } catch (Exception oEx) {
      fail("Got wrong exception while trying to resolve IRI " + oEx);
View Full Code Here

    log.debug("Resolving " + resolveXri);

    try {

      xrd = resolver.resolveSEPToXRD(new XRI(resolveXri), serviceString, null, resolverFlags, new ResolverState());
    } catch (PartialResolutionException ex) {

      log.error("Problem while resolving " + resolveXri + ": " + ex.getMessage(), ex);
      sendResponse(response, HttpServletResponse.SC_NOT_FOUND);
      return;
View Full Code Here

            // the path better be empty
            if ((oURI.getPath() != null) && (oURI.getPath().length() > 0))
                return null;

            XRD oDesc = new XRD();
            XRI oExternal = new XRI("xri://@foo");
            oDesc.addRef(new Ref(oExternal.toString()));
            XRDS oDescs = new XRDS();
            oDescs.add(oDesc);
           
      state.pushResolved(oURI.toString(), flags.toString(), oDesc.toString(), oURI);
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.