  public BwFreeBusy getFreeBusy(BwCalendar cal,
                                String account,
                                BwDateTime start,
                                BwDateTime end) throws WebdavException {
    try {
      String serviceName = getServiceName(cal.getPath());
      DominoInfo di = serversInfo.get(serviceName);
      if (di == null) {
        throw WebdavIntfException.badRequest();
      }
      DavReq req = new DavReq();
      req.setMethod("GET");
      req.setUrl(di.getUrlPrefix() + "/" +
                 cal.getOwner().getAccount() + "?" +
                 "start-min=" + makeDateTime(start) + "&" +
                 "start-max=" + makeDateTime(end));
      req.addHeader("Accept",
                    "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
      req.addHeader("Accept-Language", "en-us,en;q=0.7,es;q=0.3");
      req.addHeader("Accept-Encoding", "gzip,deflate");
      req.addHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
      DavResp resp = send(req, di);
      String vfb = makeVfb(new InputStreamReader(resp.getContentStream()));
      if (debug) {
        debugMsg(vfb);
      }
      Icalendar ic = trans.fromIcal(null, new StringReader(vfb));
      TreeSet<Period> periods = new TreeSet<Period>();
      Iterator fbit = ic.iterator();
      while (fbit.hasNext()) {
        Object o = fbit.next();
        if (o instanceof BwFreeBusy) {
          BwFreeBusy fb = (BwFreeBusy)o;
          Collection<BwFreeBusyComponent> times = fb.getTimes();
          if (times != null) {
            for (BwFreeBusyComponent fbcomp: times) {
              if (fbcomp.getType() != BwFreeBusyComponent.typeFree) {
                throw WebdavIntfException.serverError();
              }
              for (Period p: fbcomp.getPeriods()) {
                periods.add(p);
              }
            }
          }
        }
      }
      BwFreeBusy fb = new BwFreeBusy();
      fb.setStart(start);
      fb.setEnd(end);
      BwFreeBusyComponent fbcomp = new BwFreeBusyComponent();
      fb.addTime(fbcomp);
      fbcomp.setType(BwFreeBusyComponent.typeBusy);
      DateTime bstart = (DateTime)start.makeDate();
      Iterator pit = periods.iterator();
      while (pit.hasNext()) {
        Period p = (Period)pit.next();
        if (!bstart.equals(p.getStart())) {
          Period busyp = new Period(bstart, p.getStart());
          fbcomp.addPeriod(busyp);
        }
        bstart = p.getEnd();
      }
      DateTime bend = (DateTime)end.makeDate();
      if (!bstart.equals(bend)) {
        Period busyp = new Period(bstart, bend);
        fbcomp.addPeriod(busyp);
      }
      return fb;
    } catch (WebdavIntfException wie) {
      throw wie;
    } catch (Throwable t) {
      throw new WebdavIntfException(t);
    }
  }

  public BwFreeBusy getFreeBusy(BwCalendar cal,
                                String account,
                                BwDateTime start,
                                BwDateTime end) throws WebdavException {
    try {
      String serviceName = getServiceName(cal.getPath());
      DominoInfo di = serversInfo.get(serviceName);
      if (di == null) {
        throw WebdavIntfException.badRequest();
      }
      DavReq req = new DavReq();
      req.setMethod("GET");
      req.setUrl(di.getUrlPrefix() + "/" +
                 cal.getOwner().getAccount() + "?" +
                 "start-min=" + makeDateTime(start) + "&" +
                 "start-max=" + makeDateTime(end));
      req.addHeader("Accept",
                    "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
      req.addHeader("Accept-Language", "en-us,en;q=0.7,es;q=0.3");
      req.addHeader("Accept-Encoding", "gzip,deflate");
      req.addHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
      DavResp resp = send(req, di);
      String vfb = makeVfb(new InputStreamReader(resp.getContentStream()));
      if (debug) {
        debugMsg(vfb);
      }
      Icalendar ic = trans.fromIcal(null, new StringReader(vfb));
      TreeSet<Period> periods = new TreeSet<Period>();
      Iterator fbit = ic.iterator();
      while (fbit.hasNext()) {
        Object o = fbit.next();
        if (o instanceof BwFreeBusy) {
          BwFreeBusy fb = (BwFreeBusy)o;
          Collection<BwFreeBusyComponent> times = fb.getTimes();
          if (times != null) {
            for (BwFreeBusyComponent fbcomp: times) {
              if (fbcomp.getType() != BwFreeBusyComponent.typeFree) {
                throw WebdavIntfException.serverError();
              }
              for (Period p: fbcomp.getPeriods()) {
                periods.add(p);
              }
            }
          }
        }
      }
      BwFreeBusy fb = new BwFreeBusy();
      fb.setDtstart(start);
      fb.setDtend(end);
      BwFreeBusyComponent fbcomp = new BwFreeBusyComponent();
      fb.addTime(fbcomp);
      fbcomp.setType(BwFreeBusyComponent.typeBusy);
      DateTime bstart = (DateTime)start.makeDate();
      Iterator pit = periods.iterator();
      while (pit.hasNext()) {
        Period p = (Period)pit.next();
        if (!bstart.equals(p.getStart())) {
          Period busyp = new Period(bstart, p.getStart());
          fbcomp.addPeriod(busyp);
        }
        bstart = p.getEnd();
      }
      DateTime bend = (DateTime)end.makeDate();
      if (!bstart.equals(bend)) {
        Period busyp = new Period(bstart, bend);
        fbcomp.addPeriod(busyp);
      }
      return fb;
    } catch (WebdavIntfException wie) {
      throw wie;
    } catch (Throwable t) {
      throw new WebdavIntfException(t);
    }
  }
