コード例 #1
0
ファイル: View.java プロジェクト: kjella/LightCouch
  /**
   * Queries a view as an {@link InputStream}
   *
   * <p>The stream should be properly closed after usage, as to avoid connection leaks.
   *
   * @return The result as an {@link InputStream}.
   */
  public InputStream queryForStream() {
    URI uri = uriBuilder.build();
    if (allDocsKeys != null) { // bulk docs
      return getStream(dbc.post(uri, allDocsKeys));
    }
    if (mapRedtempViewM != null) { // temp view
      return getStream(dbc.post(uri, gson.toJson(mapRedtempViewM)));
    }

    return dbc.get(uri);
  }
コード例 #2
0
 /**
  * Gets a design document from the database.
  *
  * @param id The document id
  * @param rev The document revision
  * @return {@link DesignDocument}
  */
 public DesignDocument getFromDb(String id, String rev) {
   assertNotEmpty(id, "id");
   assertNotEmpty(id, "rev");
   final URI uri = buildUri(dbc.getDBUri()).path(id).query("rev", rev).build();
   return dbc.get(uri, DesignDocument.class);
 }