Package org.forgerock.json.resource
Interface SynchronousRequestHandler
-
public interface SynchronousRequestHandler
An interface for implementing synchronousRequestHandler
s. A synchronous request handler will block the caller until an operation has completed which may impact scalability in many environments, such as application servers. Therefore it is recommended that request handlers which are intended for use in production environments implement the asynchronousRequestHandler
interface. This interface can be easily "mocked" and is therefore suitable for use in unit tests.A synchronous request handler can be adapted as a
RequestHandler
using theResources.asRequestHandler(SynchronousRequestHandler)
method.For more documentation about the individual operations see
RequestHandler
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ActionResponse
handleAction(org.forgerock.services.context.Context context, ActionRequest request)
Handles performing an action on a resource, and optionally returns an associated result.ResourceResponse
handleCreate(org.forgerock.services.context.Context context, CreateRequest request)
Adds a new JSON resource.ResourceResponse
handleDelete(org.forgerock.services.context.Context context, DeleteRequest request)
Deletes a JSON resource.ResourceResponse
handlePatch(org.forgerock.services.context.Context context, PatchRequest request)
Updates a JSON resource by applying a set of changes to its existing content.QueryResponse
handleQuery(org.forgerock.services.context.Context context, QueryRequest request, Collection<ResourceResponse> resources)
Searches for all JSON resources matching a user specified set of criteria.ResourceResponse
handleRead(org.forgerock.services.context.Context context, ReadRequest request)
Reads a JSON resource.ResourceResponse
handleUpdate(org.forgerock.services.context.Context context, UpdateRequest request)
Updates a JSON resource by replacing its existing content with new content.
-
-
-
Method Detail
-
handleAction
ActionResponse handleAction(org.forgerock.services.context.Context context, ActionRequest request) throws ResourceException
Handles performing an action on a resource, and optionally returns an associated result. The execution of an action is allowed to incur side effects.- Parameters:
context
- The request server context, such as associated principal.request
- The action request.- Returns:
- The possibly
null
result of the action. - Throws:
ResourceException
- If the request failed for some reason.- See Also:
RequestHandler.handleAction(Context, ActionRequest)
-
handleCreate
ResourceResponse handleCreate(org.forgerock.services.context.Context context, CreateRequest request) throws ResourceException
Adds a new JSON resource.- Parameters:
context
- The request server context, such as associated principal.request
- The create request.- Returns:
- The new resource.
- Throws:
ResourceException
- If the request failed for some reason.- See Also:
RequestHandler.handleCreate(Context, CreateRequest)
-
handleDelete
ResourceResponse handleDelete(org.forgerock.services.context.Context context, DeleteRequest request) throws ResourceException
Deletes a JSON resource.- Parameters:
context
- The request server context, such as associated principal.request
- The delete request.- Returns:
- The deleted resource.
- Throws:
ResourceException
- If the request failed for some reason.- See Also:
RequestHandler.handleDelete(Context, DeleteRequest)
-
handlePatch
ResourceResponse handlePatch(org.forgerock.services.context.Context context, PatchRequest request) throws ResourceException
Updates a JSON resource by applying a set of changes to its existing content.- Parameters:
context
- The request server context, such as associated principal.request
- The patch request.- Returns:
- The patched resource.
- Throws:
ResourceException
- If the request failed for some reason.- See Also:
RequestHandler.handlePatch(Context, PatchRequest)
-
handleQuery
QueryResponse handleQuery(org.forgerock.services.context.Context context, QueryRequest request, Collection<ResourceResponse> resources) throws ResourceException
Searches for all JSON resources matching a user specified set of criteria.- Parameters:
context
- The request server context, such as associated principal.request
- The query request.resources
- A non-null
collection into which matching resources should be put.- Returns:
- The query result.
- Throws:
ResourceException
- If the request failed for some reason.- See Also:
RequestHandler.handleQuery(Context, QueryRequest, QueryResourceHandler)
-
handleRead
ResourceResponse handleRead(org.forgerock.services.context.Context context, ReadRequest request) throws ResourceException
Reads a JSON resource.- Parameters:
context
- The request server context, such as associated principal.request
- The read request.- Returns:
- The resource.
- Throws:
ResourceException
- If the request failed for some reason.- See Also:
RequestHandler.handleRead(Context, ReadRequest)
-
handleUpdate
ResourceResponse handleUpdate(org.forgerock.services.context.Context context, UpdateRequest request) throws ResourceException
Updates a JSON resource by replacing its existing content with new content.- Parameters:
context
- The request server context, such as associated principal.request
- The update request.- Returns:
- The updated resource.
- Throws:
ResourceException
- If the request failed for some reason.- See Also:
RequestHandler.handleUpdate(Context, UpdateRequest)
-
-