Package org.openxri.xml

Examples of org.openxri.xml.Status


      ArrayList selectedSvcs = selectServices(xrd.getServices(), sepType, path, sepMediaType);
      if (selectedSvcs.size() == 0) {
        // do reference processing
        ArrayList refs = xrd.getPrioritizedRefs();
        if (refs.size() == 0) {
          Status s = new Status(Status.SEP_NOT_FOUND, "Requested service endpoint not found.");
          xrdsOut.getFinalXRD().setStatus(s);
          throw new PartialResolutionException(xrdsOut);
        }
       
        if (maxFollowRefs >= 0 && state.getNumRefsFollowed() >= maxFollowRefs) {
          Status s = new Status(Status.LIMIT_EXCEEDED, "Maximum number of references exceeded");
          xrdsOut.getFinalXRD().setStatus(s);
          throw new PartialResolutionException(xrdsOut);         
        }

        // 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
            if (i == refs.size()) {
                Status s = new Status(Status.SEP_NOT_FOUND, "Invalid ref encountered: " + e.getMessage());
                xrdsOut.getFinalXRD().setStatus(s);
                throw new PartialResolutionException(xrdsOut);
            }
            else // try next one
              continue;
View Full Code Here


 
  public XRD createErrorXRD(String query, String code, String msg)
  {
    XRD err = new XRD();
    err.setQuery(query);
    Status stat = new Status(code, msg);
    err.setStatus(stat);
    return err;
  }
View Full Code Here

            // if we got the nonexistent "command" return a not found
            if (uri.getPath().indexOf("!nonexistent") >= 0)
            {
                XRD xrd = new XRD();
                xrd.setQuery("!nonexistent");
                xrd.setStatus(new Status(Status.AUTH_RES_NOT_FOUND));
                XRDS xrds = new XRDS();
                xrds.add(xrd);
                return new ByteArrayInputStream(xrds.toString().getBytes());
            }

            XRDS oDescs = new XRDS();

            // just the same response always
            XRD oFoo = new XRD();
            oFoo.setQuery("!foo");
            oFoo.setStatus(new Status(Status.SUCCESS));
            oDescs.add(oFoo);

            XRD oBar = new XRD();
            oBar.setQuery("!bar");
            oBar.setStatus(new Status(Status.SUCCESS));
            oDescs.add(oBar);

            if (uri.getPath().indexOf("!baz") > 0) {
              XRD baz = new XRD();
              baz.setQuery("!baz");
              baz.setStatus(new Status(Status.AUTH_RES_NOT_FOUND, "Not found"));
                oDescs.add(baz);
            }
            return new ByteArrayInputStream(oDescs.toString().getBytes());

        } // getDataFromURI()
View Full Code Here

TOP

Related Classes of org.openxri.xml.Status

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.