Package org.forgerock.json.resource
Class Responses
- java.lang.Object
-
- org.forgerock.json.resource.Responses
-
public final class Responses extends Object
A utility class containing various factory methods for creating and manipulating responses.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ActionResponse
newActionResponse(JsonValue json)
Returns a newJsonValue
response with the provided JSON content.static QueryResponse
newQueryResponse()
Creates a new query result with anull
paged results cookie and no count of the total number of remaining results.static QueryResponse
newQueryResponse(String pagedResultsCookie)
Creates a new query result with the provided paged results cookie and no count.static QueryResponse
newQueryResponse(String pagedResultsCookie, CountPolicy totalPagedResultsPolicy, int totalPagedResults)
Creates a new query result with the provided paged results cookie and a count of the total number of remaining results according to totalPagedResultsPolicy.static QueryResponse
newRemainingResultsResponse(String pagedResultsCookie, int remainingPagedResults)
Deprecated.UsenewQueryResponse(String, CountPolicy, int)
instead.static ResourceResponse
newResourceResponse(String id, String revision, JsonValue content)
Returns a newResource
response with the provided Resource as content.
-
-
-
Method Detail
-
newActionResponse
public static ActionResponse newActionResponse(JsonValue json)
Returns a newJsonValue
response with the provided JSON content.- Parameters:
json
- The JSON content.- Returns:
- The new
ActionResponse
.
-
newResourceResponse
public static ResourceResponse newResourceResponse(String id, String revision, JsonValue content)
Returns a newResource
response with the provided Resource as content.- Parameters:
id
- The resource ID if applicable otherwisenull
.revision
- The resource version, if known.content
- The resource content.- Returns:
- The new
Resource
response.
-
newQueryResponse
public static QueryResponse newQueryResponse()
Creates a new query result with anull
paged results cookie and no count of the total number of remaining results.- Returns:
- The new
QueryResponse
.
-
newQueryResponse
public static QueryResponse newQueryResponse(String pagedResultsCookie)
Creates a new query result with the provided paged results cookie and no count.- Parameters:
pagedResultsCookie
- The opaque cookie which should be used with the next paged results query request, ornull
if paged results were not requested, or if there are not more pages to be returned.- Returns:
- The new
QueryResponse
.
-
newQueryResponse
public static QueryResponse newQueryResponse(String pagedResultsCookie, CountPolicy totalPagedResultsPolicy, int totalPagedResults)
Creates a new query result with the provided paged results cookie and a count of the total number of remaining results according to totalPagedResultsPolicy.- Parameters:
pagedResultsCookie
- The opaque cookie which should be used with the next paged results query request, ornull
if paged results were not requested, or if there are not more pages to be returned.totalPagedResultsPolicy
- The policy that was used to calculate totalPagedResultstotalPagedResults
- The total number of paged results requested in adherence to theQueryRequest.getTotalPagedResultsPolicy()
in the request, orQueryResponse.NO_COUNT
if paged results were not requested, the count policy isNONE
, or if the total number of remaining results is unknown.- Returns:
- The new
QueryResponse
.
-
newRemainingResultsResponse
@Deprecated public static QueryResponse newRemainingResultsResponse(String pagedResultsCookie, int remainingPagedResults)
Deprecated.UsenewQueryResponse(String, CountPolicy, int)
instead.Creates a new query result with the provided paged results cookie and an estimate of the total number of remaining results.- Parameters:
pagedResultsCookie
- The opaque cookie which should be used with the next paged results query request, ornull
if paged results were not requested, or if there are not more pages to be returned.remainingPagedResults
- An estimate of the total number of remaining results to be returned in subsequent paged results query requests, or-1
if paged results were not requested, or if the total number of remaining results is unknown.- Returns:
- The new
QueryResponse
.
-
-