Examples of XRI


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

Examples of org.openxri.XRI

   * @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

Examples of org.openxri.XRI

    }
  }

  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

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

Examples of org.openxri.XRI

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

Examples of org.openxri.XRI

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

Examples of org.openxri.XRI

    @Override
    protected void onSubmit() {

      try {

        new XRI(this.xri);
      } catch (Exception ex) {

        Index.this.error(Index.this._xrifail);
        return;
      }
View Full Code Here

Examples of org.openxri.XRI

    @Override
    protected void onSubmit() {

      try {

        new XRI(this.xri);
      } catch (Exception ex) {

        Index.this.error(Index.this._xrifail);
        return;
      }
View Full Code Here

Examples of org.openxri.XRI

      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

Examples of org.openxri.XRI

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