Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Security Level: Public
-
Labels:None
Description
The Java API provide most of the time access to the JSON document (as string):
- get commands
- view command using the ViewRow.getDocument
When we call a view the result is a ViewResponse, but it is not possible to get the JSON document out of it, and the view engine returned a JSON doc.
It could be interesting for some development, to be able to do a viewResponse.toJSON() that returns the exact result of the view. (this function may not be compliant with the includesDoc(true) option)
The use case is simple, suppose I am creating a REST API and I would like to call the view and return the result to the user it would be good to do something like :
@GET
@Produces({ "application/json"})
@Path("/person/")
public String getPersons( ) {
View view = client.getView(PERSON_DSGN_DOC, PERSON_BY_NAME_VIEW);
Query query = new Query();
ViewResponse viewResponse = client.query(view, query);
return viewResponse.toJSON();
}
Today I have to loop on each result and create a new object/document
- get commands
- view command using the ViewRow.getDocument
When we call a view the result is a ViewResponse, but it is not possible to get the JSON document out of it, and the view engine returned a JSON doc.
It could be interesting for some development, to be able to do a viewResponse.toJSON() that returns the exact result of the view. (this function may not be compliant with the includesDoc(true) option)
The use case is simple, suppose I am creating a REST API and I would like to call the view and return the result to the user it would be good to do something like :
@GET
@Produces({ "application/json"})
@Path("/person/")
public String getPersons( ) {
View view = client.getView(PERSON_DSGN_DOC, PERSON_BY_NAME_VIEW);
Query query = new Query();
ViewResponse viewResponse = client.query(view, query);
return viewResponse.toJSON();
}
Today I have to loop on each result and create a new object/document
Activity
- All
- Comments
- Work Log
- History
- Activity
- Gerrit Reviews