예제 #1
0
  public boolean pageExists(String space, String page) {
    boolean exists;
    try {
      executeGet(getURL(space, page), Status.OK.getStatusCode());
      exists = true;
    } catch (Exception e) {
      exists = false;
    }

    return exists;
  }
예제 #2
0
  // FIXME: improve that with a REST API to directly import a XAR
  public void importXar(File file) throws Exception {
    // attach file
    attachFile("XWiki", "Import", file.getName(), file, false);

    // import file
    executeGet(
        BASE_BIN_URL
            + "import/XWiki/Import?historyStrategy=add&importAsBackup=true&ajax&action=import&name="
            + escapeURL(file.getName()),
        Status.OK.getStatusCode());
  }