private List<ShareInfo> getShareInfos(HttpServletRequest request) {
   List<ShareInfo> result = new ArrayList<ShareInfo>();
   User user = securityService.getCurrentUser(request);
   for (Share share : shareService.getSharesForUser(user)) {
     List<MediaFile> files = shareService.getSharedFiles(share.getId());
     if (!files.isEmpty()) {
       MediaFile file = files.get(0);
       result.add(
           new ShareInfo(share, file.isDirectory() ? file : mediaFileService.getParentOf(file)));
     }
   }
   return result;
 }
  private String handleParameters(HttpServletRequest request) {
    User user = securityService.getCurrentUser(request);
    for (Share share : shareService.getSharesForUser(user)) {
      int id = share.getId();

      String description = getParameter(request, "description", id);
      boolean delete = getParameter(request, "delete", id) != null;
      String expireIn = getParameter(request, "expireIn", id);

      if (delete) {
        shareService.deleteShare(id);
      } else {
        if (expireIn != null) {
          share.setExpires(parseExpireIn(expireIn));
        }
        share.setDescription(description);
        shareService.updateShare(share);
      }
    }

    return null;
  }
  public void getShares(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);
    Player player = playerService.getPlayer(request, response);

    User user = securityService.getCurrentUser(request);
    XMLBuilder builder = createXMLBuilder(request, response, true);

    builder.add("shares", false);
    for (Share share : shareService.getSharesForUser(user)) {
      builder.add("share", createAttributesForShare(share), false);

      for (MediaFile mediaFile : shareService.getSharedFiles(share.getId())) {
        File coverArt = mediaFileService.getCoverArt(mediaFile);
        AttributeSet attributes =
            restBrowseController.createAttributesForMediaFile(player, coverArt, mediaFile);
        builder.add("entry", attributes, true);
      }

      builder.end();
    }
    builder.endAll();
    response.getWriter().print(builder);
  }