Package org.openxri

Examples of org.openxri.XRI


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


    throws PartialResolutionException
  {
    log.trace("resolveSEPToXRDS(s'" + qxri + "', trustType=" + trustType + ", sepType=" + sepType
        + ", sepMediaType=" + sepMediaType + ", followRefs=" + followRefs + ")");
 
    XRI xri = parseAbsoluteQXRIOrError(qxri);
    return resolveSEPToXRDS(xri, trustType, sepType, sepMediaType, followRefs, state);
  }
View Full Code Here

    throws PartialResolutionException
  {
    log.trace("resolveSEPToXRD(s'" + qxri + "', trustType=" + trustType + ", sepType=" + sepType
        + ", sepMediaType=" + sepMediaType + ", followRefs=" + followRefs + ")");
   
    XRI xri = parseAbsoluteQXRIOrError(qxri);
    return resolveSEPToXRD(xri, trustType, sepType, sepMediaType, followRefs, state);
  }
View Full Code Here

    throws PartialResolutionException
    {
    log.trace("resolveSEPToURIList(s'" + qxri + "', trustType=" + trustType + ", sepType=" + sepType
        + ", sepMediaType=" + sepMediaType + ", followRefs=" + followRefs + ")");
   
    XRI xri = parseAbsoluteQXRIOrError(qxri);
    return resolveSEPToURIList(xri, trustType, sepType, sepMediaType, followRefs, state);
    }
View Full Code Here

   

    ///// attempt each ref in turn
    for (int i = 0; i < refs.size(); i++) {
      Ref r = (Ref)refs.get(i);
      XRI refXRI = null;
      try {
        refXRI = parseAbsoluteQXRIOrError(r.getValue());
      }
      catch (PartialResolutionException e) {
        log.warn("resolveAuthSegment - Invalid ref encountered: " + e.getMessage());
View Full Code Here

        }

        // we have some references, let's process it
        for (int i = 0; i < refs.size(); i++) {
          Ref r = (Ref)refs.get(i);
          XRI refXRI = null;
          try {
            refXRI = new XRI(r.getValue());
          }
          catch (XRIParseException e) {
            log.warn("resolveAuthSegment - Invalid ref encountered: " + e.getMessage());
           
            // bail out if this is the last segment
View Full Code Here

     */
    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;
      }
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

      Authority authority;

      try {

        XRI xri = new XRI(this.xri);
        XRIAuthority xriAuthority = ((XRIAuthority) xri.getAuthorityPath());

        authority = ((StoreBetterLookup) openXRIStore).localLookup(xriAuthority);

        if (authority == null) throw new StoreNotFoundException();
      } catch (StoreNotFoundException ex) {
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.