Package org.myphotodiary.json

Examples of org.myphotodiary.json.JsonArray


        rsp.addParameter(Configuration.groupParam,
            (directory.getGroup() == null ? Configuration.publicGroup : directory.getGroup().getGroupName()));

        List<Attribute> dirAttributes = directory.getAttributes();
        if (dirAttributes != null) {
          JsonArray attributes = new JsonArray();
          for (Attribute attribute: dirAttributes) {
            attributes.addItem(attribute.getName());
          }
          rsp.addParameter(Configuration.attrParam, attributes);
        }
      }
      else {
View Full Code Here


        rsp.addParameter(Configuration.descParam, img.getDescription())
        .addParameter(Configuration.ratingParam, img.getRating())
        .addParameter(Configuration.dateParam, img.getDate().toString());
        List<Attribute> imgAttributes = img.getAttributes();
        if (imgAttributes != null) {
          JsonArray attributes = new JsonArray();
          for (Attribute attribute: imgAttributes) {
            attributes.addItem(attribute.getName());
          }
          rsp.addParameter(Configuration.attrParam, attributes);
        }
      }
      else {
View Full Code Here

      } catch (NoResultException ex) {
        getServletContext().log("No attribute.", ex);
      }

      // Create Json response
      JsonArray rsp = new JsonArray();
      for (Attribute attribute: attributes) {
        rsp.addItem(attribute.getName());
      }
      getServletContext().log("Json response: " + rsp.toString());
      // Reply the Json response
      response.setContentType(Configuration.jsonContentType);
      response.setCharacterEncoding(Configuration.contentEncoding);
      PrintWriter out = response.getWriter();
      out.print(rsp.toString());
      out.flush();
    } catch (Exception ex) {
      getServletContext().log("Cannot GET image data", ex);
      response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
      return;
View Full Code Here

        images = new LinkedList<Image>();
      }

      // Create Json response
      JsonObject rsp = new JsonObject();
      JsonArray imgList = new JsonArray();
      JsonArray thumbList = new JsonArray();
      // Get the image specific data
      for (Image img : images) {
        // Apply access control rules
        try {
          AccessController.checkAuthorization(img.getDirectory(), request, Action.browse, null);
 
          JsonObject im = new JsonObject();
          JsonObject th = new JsonObject();
          im.addParameter(Configuration.urlParam, cfg.getImageRootUrl(request)
              + img.getDirectory().getPath() + "/"  + Configuration.webImgDirName + "/" + img.getName());
          imgList.addItem(im);
          th.addParameter(Configuration.urlParam, cfg.getImageRootUrl(request)
              + img.getDirectory().getPath() + "/"
              + Configuration.thumbDirName + "/" + img.getName());
          thumbList.addItem(th);
        }
        catch (AuthenticationException ex) {
          // access not allowed, skip
        }
      }
View Full Code Here

        rsp.addParameter(Configuration.descParam, img.getDescription())
        .addParameter(Configuration.ratingParam, img.getRating())
        .addParameter(Configuration.dateParam, img.getDate().toString());
        List<Attribute> imgAttributes = img.getAttributes();
        if (imgAttributes != null) {
          JsonArray attributes = new JsonArray();
          for (Attribute attribute: imgAttributes) {
            attributes.addItem(attribute.getName());
          }
          rsp.addParameter(Configuration.attrParam, attributes);
        }
      }
      else {
View Full Code Here

TOP

Related Classes of org.myphotodiary.json.JsonArray

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.