Package org.openxri

Examples of org.openxri.XRI


    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

   
    public void testEquivalence()
    {
      try {
        XRI x1 = XRI.fromURINormalForm("xri://@foo*(=bar%2Fbaz)");
        XRI x2 = new XRI("@foo*(=bar/baz)");
        assertTrue("x1 and x2 should be equivalent", x1.equals(x2));
      }
      catch (Exception e) {
        fail("Not expecting exception here: " + e);
      }
View Full Code Here

      log.debug("processProxyRequest - sXRI is null or empty");
      sendResponse(response, 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
      log.warn("Error constructing XRI: " + qxri + ", " + oEx);
      sendResponse(response,HTTP_ERROR_CONTENT_TYPE, "INVALID_QXRI(code=211): "+oEx.getMessage(),null);
      return;
    }


    // defaults if resolution media type is null
    TrustType trustType = new TrustType();
    boolean refs = true;
    boolean sep = true;

    String tempStr = null;
    if(resMediaType != null) {
      tempStr = resMediaType.getParam(MimeType.PARAM_REFS);
      if(tempStr != null && tempStr.equals("false"))
        refs = false;

      tempStr = resMediaType.getParam(MimeType.PARAM_SEP);
      if(tempStr != null && tempStr.equals("false"))
        sep = false;

      tempStr = resMediaType.getParam(MimeType.PARAM_TRUST);
      if (tempStr != null) {
        try {
          trustType.setType(tempStr);
        }
        catch (IllegalTrustTypeException e) {
          sendResponse(response, HTTP_ERROR_CONTENT_TYPE, "INVALID_RESOLUTION_MEDAIA_TYPE(code=212): " + resMediaType, null);
          return;
        }
      }
    }

    // set the request preferences on the resolver before querying.
    XRDS xrds = null;
    XRD xrd = null;
    try
    {
      if (sep) {
        if (resMediaType == null) {
          // see section 7.6 for special redirect rule
          ArrayList uris = resolver.resolveSEPToURIList(oXRI.toString(), trustType, serviceType, serviceMediaType, refs);
          if (uris == null || uris.size() == 0) {
            sendResponse(response, HTTP_ERROR_CONTENT_TYPE, "SEP_NOT_FOUND(code=241): no url found", null);
            return;
          }
          String s = (String) uris.get(0);

          log.trace("Sending redirect to '" + s + "'");

          response.sendRedirect(s);
        }
        else if (resMediaType.isType(MimeType.URI_LIST)) {
          String  text = resolver.resolveSEPToTextURIList(oXRI.toString(), trustType, serviceType, serviceMediaType, refs);
          if (text.length() <= 0)
            sendResponse(response, HTTP_ERROR_CONTENT_TYPE, "SEP_NOT_FOUND(code=241): no url found", null);
          else
            sendResponse(response, resMediaType.getType(), text, null);
        }
View Full Code Here

    try {
      Resolver resolver = setupResolver();
      qxri = "(@blog*lockbox)*peter2";
                        septype="xri://$certificate*($x.509)";
      XRI xri = XRI.fromIRINormalForm(qxri);

      ResolverFlags flags = new ResolverFlags();
      flags.setUric(true);
      flags.setHttps(false);
      flags.setSaml(true);
View Full Code Here

    String qxri;

    try {
      Resolver resolver = setupResolver();
      qxri = "@blog*lockbox*peter2";
      XRI xri = XRI.fromIRINormalForm(qxri);

      ResolverFlags flags = new ResolverFlags();
      flags.setUric(true);
      flags.setHttps(false);
      flags.setSaml(true);
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

            // 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.