예제 #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);
 }