@Produces(value="application/vnd.oracle.glassfish+json") public abstract class CompositeResource extends AbstractResource implements RestResource
@Path
and @Service
annotations are still
required, though, in order for the resource to be located and configured properly.Modifier and Type | Class and Description |
---|---|
class |
CompositeResource.CommandInvoker |
class |
CompositeResource.CreateCommandInvoker |
Modifier and Type | Field and Description |
---|---|
protected CompositeUtil |
compositeUtil |
static String |
CONSUMES_TYPE |
protected static String |
DETACHED |
protected static String |
DETACHED_DEFAULT |
protected static String |
EXCLUDE |
protected static String |
INCLUDE |
protected static int |
THREAD_POOL_CORE |
protected static int |
THREAD_POOL_MAX |
locatorBridge, logger, requestHeaders, securityContext, serviceLocator, subjectRef, uriInfo
Constructor and Description |
---|
CompositeResource() |
Modifier and Type | Method and Description |
---|---|
protected javax.ws.rs.core.Response |
accepted(ResponseBody rb,
String message,
URI jobUri,
URI newItemUri) |
protected javax.ws.rs.core.Response |
accepted(ResponseBody rb,
URI jobUri,
URI newItemUri) |
protected javax.ws.rs.core.Response |
accepted(String command,
ParameterMap parameters,
URI childUri) |
protected javax.ws.rs.core.Response |
accepted(String message,
URI jobUri,
URI newItemUri) |
protected javax.ws.rs.core.Response |
act(CompositeResource.CommandInvoker invoker,
boolean detached) |
protected javax.ws.rs.core.Response |
acted(ResponseBody rb) |
protected javax.ws.rs.core.Response |
acted(ResponseBody rb,
String message) |
protected javax.ws.rs.core.Response |
acted(String message) |
protected javax.ws.rs.core.Response |
actSse(CompositeResource.CommandInvoker invoker) |
protected void |
addActionResourceLink(ResponseBody rb,
String action) |
protected void |
addResourceLink(ResponseBody rb,
String rel) |
protected javax.ws.rs.core.Response |
badRequest(ResponseBody rb) |
protected javax.ws.rs.core.Response |
badRequest(ResponseBody rb,
String message) |
protected javax.ws.rs.WebApplicationException |
badRequest(String message) |
protected javax.ws.rs.WebApplicationException |
badRequest(Throwable cause) |
protected javax.ws.rs.core.Response |
create(CompositeResource.CreateCommandInvoker invoker,
boolean detached) |
protected javax.ws.rs.core.Response |
created(ResponseBody rb,
String name) |
protected javax.ws.rs.core.Response |
created(ResponseBody rb,
String name,
String message) |
protected javax.ws.rs.core.Response |
created(ResponseBody rb,
URI uri) |
protected javax.ws.rs.core.Response |
created(String name,
String message) |
protected javax.ws.rs.core.Response |
createSse(CompositeResource.CreateCommandInvoker invoker) |
protected javax.ws.rs.core.Response |
deleted(ResponseBody rb) |
protected javax.ws.rs.core.Response |
deleted(ResponseBody rb,
String message) |
protected javax.ws.rs.core.Response |
deleted(String message) |
protected ActionReporter |
executeCommand(String command,
ParameterMap parameters,
javax.ws.rs.core.Response.Status status,
boolean includeFailureMessage,
boolean throwOnWarning)
Execute an
AdminCommand with the specified parameters. |
protected ActionReporter |
executeDeleteCommand(String command)
Execute a delete
AdminCommand with no parameters. |
protected ActionReporter |
executeDeleteCommand(String command,
ParameterMap parameters)
Execute a delete
AdminCommand with the specified parameters. |
protected ActionReporter |
executeDeleteCommandManaged(String command,
ParameterMap parameters)
Execute a delete
AdminCommand with the specified parameters. |
protected ActionReporter |
executeReadCommand(String command)
Execute a read-only
AdminCommand with the specified parameters. |
protected ActionReporter |
executeReadCommand(String command,
ParameterMap parameters)
Execute a read-only
AdminCommand with no parameters. |
protected org.glassfish.jersey.media.sse.EventOutput |
executeSseCommand(Subject subject,
String command,
ParameterMap parameters)
Execute an
AdminCommand with the specified parameters and
return EventOutput suitable for SSE. |
protected org.glassfish.jersey.media.sse.EventOutput |
executeSseCommand(Subject subject,
String command,
ParameterMap parameters,
ResponseBodyBuilder builder)
Execute an
AdminCommand via SSE, but provide an ActionReportProcessor that allows
the calling resource, via an EntityBuilder instance, to return a ResponseBody that
extra information such as the newly create entity, as well as any messages returned by the subsystem. |
protected org.glassfish.jersey.media.sse.EventOutput |
executeSseCommand(Subject subject,
String command,
ParameterMap parameters,
SseCommandHelper.ActionReportProcessor processor)
Execute an
AdminCommand with the specified parameters and
return EventOutput suitable for SSE. |
protected ActionReporter |
executeWriteCommand(String command)
Execute a writing
AdminCommand with no parameters. |
protected ActionReporter |
executeWriteCommand(String command,
ParameterMap parameters)
Execute a writing
AdminCommand with the specified parameters. |
protected ActionReporter |
executeWriteCommandManaged(String command,
ParameterMap parameters)
Execute a writing
AdminCommand with the specified parameters. |
protected <T extends RestModel> |
filterModel(Class<T> modelIface,
T unfilteredModel,
JsonFilter filter) |
protected <T extends RestModel> |
filterModel(Class<T> modelIface,
T unfilteredModel,
String include,
String exclude) |
protected <T extends RestModel> |
filterModel(Class<T> modelIface,
T unfilteredModel,
String include,
String exclude,
String identityAttr) |
protected String |
generateDefaultName(String namePrefix,
Collection<String> usedNames)
TBD - Jason Lee wants to move this into the defaults generators.
|
protected URI |
getChildItemUri(String name)
Every resource that returns a collection will need to return the URI for each item in the collection.
|
protected URI |
getCollectionChildParentUri() |
CompositeUtil |
getCompositeUtil() |
protected ExecutorService |
getExecutorService() |
protected JsonFilter |
getFilter(String include,
String exclude) |
protected JsonFilter |
getFilter(String include,
String exclude,
String identityAttr) |
protected javax.json.JsonObject |
getJsonModel(RestModel typedModel) |
protected Locale |
getLocale() |
protected URI |
getParentUri() |
protected String |
getPathParam(String name)
Convenience method for getting a path parameter.
|
protected javax.ws.rs.core.Response |
getResponse(javax.ws.rs.core.Response.Status status,
ResponseBody responseBody) |
protected javax.ws.rs.core.Response |
getResponse(ResponseBody responseBody) |
<T> T |
getSubResource(Class<T> clazz)
This method creates a sub-resource of the specified type.
|
protected URI |
getSubUri(String name) |
protected <T extends RestModel> |
getTypedModel(Class<T> modelIface,
javax.json.JsonObject jsonModel) |
protected URI |
getUri(String path) |
protected boolean |
includeResourceLinks() |
protected URI |
launchDetachedCommand(String command,
ParameterMap parameters) |
protected <T> T |
newModel(Class<T> modelIface) |
protected <T extends RestModel> |
newTemplate(Class<T> modelIface) |
protected javax.ws.rs.WebApplicationException |
notFound(String message) |
protected javax.ws.rs.core.Response |
ok(ResponseBody rb) |
protected ParameterMap |
parameterMap() |
protected ResponseBody |
responseBody() |
protected <T extends RestModel> |
restCollectionResponseBody(Class<T> modelIface,
String collectionName) |
protected <T extends RestModel> |
restCollectionResponseBody(Class<T> modelIface,
String collectionName,
URI parentUri) |
protected <T extends RestModel> |
restModelResponseBody(Class<T> modelIface) |
protected <T extends RestModel> |
restModelResponseBody(Class<T> modelIface,
URI parentUri) |
protected <T extends RestModel> |
restModelResponseBody(Class<T> modelIface,
URI parentUri,
T entity) |
void |
setSubjectRef(org.glassfish.jersey.internal.util.collection.Ref<Subject> subjectRef) |
protected javax.ws.rs.core.Response |
updated(ResponseBody rb) |
protected javax.ws.rs.core.Response |
updated(ResponseBody rb,
String message) |
protected javax.ws.rs.core.Response |
updated(String message) |
getAuthenticatedUser, getSubject
public static final String CONSUMES_TYPE
protected static final String DETACHED
protected static final String DETACHED_DEFAULT
protected static final String INCLUDE
protected static final String EXCLUDE
protected static final int THREAD_POOL_CORE
protected static final int THREAD_POOL_MAX
protected CompositeUtil compositeUtil
public void setSubjectRef(org.glassfish.jersey.internal.util.collection.Ref<Subject> subjectRef)
public CompositeUtil getCompositeUtil()
public <T> T getSubResource(Class<T> clazz)
WebApplicationException
with an HTTP status code of 500 (internal server error).clazz
- The Class of the desired sub-resourceprotected <T> T newModel(Class<T> modelIface)
protected <T extends RestModel> T getTypedModel(Class<T> modelIface, javax.json.JsonObject jsonModel) throws Exception
Exception
protected javax.json.JsonObject getJsonModel(RestModel typedModel) throws Exception
Exception
protected URI getChildItemUri(String name)
name
- protected void addResourceLink(ResponseBody rb, String rel) throws Exception
Exception
protected void addActionResourceLink(ResponseBody rb, String action) throws Exception
Exception
protected boolean includeResourceLinks()
protected URI getCollectionChildParentUri() throws Exception
Exception
protected ActionReporter executeDeleteCommand(String command)
AdminCommand
with no parameters.command
- protected ActionReporter executeDeleteCommand(String command, ParameterMap parameters)
AdminCommand
with the specified parameters.command
- parameters
- protected ActionReporter executeDeleteCommandManaged(String command, ParameterMap parameters)
AdminCommand
with the specified parameters.command
- parameters
- protected ActionReporter executeWriteCommand(String command)
AdminCommand
with no parameters.command
- protected ActionReporter executeWriteCommand(String command, ParameterMap parameters)
AdminCommand
with the specified parameters.command
- parameters
- protected ActionReporter executeWriteCommandManaged(String command, ParameterMap parameters)
AdminCommand
with the specified parameters.command
- parameters
- protected ActionReporter executeReadCommand(String command)
AdminCommand
with the specified parameters.command
- parameters
- protected ActionReporter executeReadCommand(String command, ParameterMap parameters)
AdminCommand
with no parameters.command
- parameters
- protected ActionReporter executeCommand(String command, ParameterMap parameters, javax.ws.rs.core.Response.Status status, boolean includeFailureMessage, boolean throwOnWarning)
AdminCommand
with the specified parameters.command
- parameters
- status
- includeFailureMessage
- throwOnWarning
- (vs.ignore warning)protected org.glassfish.jersey.media.sse.EventOutput executeSseCommand(Subject subject, String command, ParameterMap parameters, ResponseBodyBuilder builder)
AdminCommand
via SSE, but provide an ActionReportProcessor
that allows
the calling resource, via an EntityBuilder
instance, to return a ResponseBody
that
extra information such as the newly create entity, as well as any messages returned by the subsystem.protected org.glassfish.jersey.media.sse.EventOutput executeSseCommand(Subject subject, String command, ParameterMap parameters, SseCommandHelper.ActionReportProcessor processor)
AdminCommand
with the specified parameters and
return EventOutput suitable for SSE.protected org.glassfish.jersey.media.sse.EventOutput executeSseCommand(Subject subject, String command, ParameterMap parameters)
AdminCommand
with the specified parameters and
return EventOutput suitable for SSE.protected String generateDefaultName(String namePrefix, Collection<String> usedNames)
namePrefix
- usedNames
- protected javax.ws.rs.core.Response created(String name, String message) throws Exception
Exception
protected javax.ws.rs.core.Response created(ResponseBody rb, String name, String message) throws Exception
Exception
protected javax.ws.rs.core.Response created(ResponseBody rb, String name) throws Exception
Exception
protected javax.ws.rs.core.Response created(ResponseBody rb, URI uri) throws Exception
Exception
protected javax.ws.rs.core.Response updated(String message)
protected javax.ws.rs.core.Response updated(ResponseBody rb, String message)
protected javax.ws.rs.core.Response updated(ResponseBody rb)
protected javax.ws.rs.core.Response deleted(String message)
protected javax.ws.rs.core.Response deleted(ResponseBody rb, String message)
protected javax.ws.rs.core.Response deleted(ResponseBody rb)
protected javax.ws.rs.core.Response acted(String message)
protected javax.ws.rs.core.Response acted(ResponseBody rb, String message)
protected javax.ws.rs.core.Response acted(ResponseBody rb)
protected javax.ws.rs.core.Response accepted(ResponseBody rb, String message, URI jobUri, URI newItemUri)
protected javax.ws.rs.core.Response accepted(ResponseBody rb, URI jobUri, URI newItemUri)
protected javax.ws.rs.core.Response accepted(String command, ParameterMap parameters, URI childUri)
protected URI launchDetachedCommand(String command, ParameterMap parameters)
protected javax.ws.rs.core.Response ok(ResponseBody rb)
protected javax.ws.rs.core.Response badRequest(ResponseBody rb, String message)
protected javax.ws.rs.core.Response badRequest(ResponseBody rb)
protected javax.ws.rs.WebApplicationException badRequest(Throwable cause)
protected javax.ws.rs.WebApplicationException badRequest(String message)
protected javax.ws.rs.WebApplicationException notFound(String message)
protected <T extends RestModel> RestCollectionResponseBody<T> restCollectionResponseBody(Class<T> modelIface, String collectionName, URI parentUri)
protected <T extends RestModel> RestCollectionResponseBody<T> restCollectionResponseBody(Class<T> modelIface, String collectionName)
protected <T extends RestModel> RestModelResponseBody<T> restModelResponseBody(Class<T> modelIface, URI parentUri, T entity)
protected <T extends RestModel> RestModelResponseBody<T> restModelResponseBody(Class<T> modelIface, URI parentUri)
protected <T extends RestModel> RestModelResponseBody<T> restModelResponseBody(Class<T> modelIface)
protected ResponseBody responseBody()
protected javax.ws.rs.core.Response getResponse(ResponseBody responseBody)
protected javax.ws.rs.core.Response getResponse(javax.ws.rs.core.Response.Status status, ResponseBody responseBody)
protected JsonFilter getFilter(String include, String exclude) throws Exception
Exception
protected JsonFilter getFilter(String include, String exclude, String identityAttr) throws Exception
Exception
protected <T extends RestModel> T filterModel(Class<T> modelIface, T unfilteredModel, String include, String exclude) throws Exception
Exception
protected <T extends RestModel> T filterModel(Class<T> modelIface, T unfilteredModel, String include, String exclude, String identityAttr) throws Exception
Exception
protected <T extends RestModel> T filterModel(Class<T> modelIface, T unfilteredModel, JsonFilter filter) throws Exception
Exception
protected Locale getLocale()
protected String getPathParam(String name)
name
- protected ParameterMap parameterMap()
protected ExecutorService getExecutorService()
protected javax.ws.rs.core.Response act(CompositeResource.CommandInvoker invoker, boolean detached)
protected javax.ws.rs.core.Response actSse(CompositeResource.CommandInvoker invoker)
protected javax.ws.rs.core.Response create(CompositeResource.CreateCommandInvoker invoker, boolean detached) throws Exception
Exception
protected javax.ws.rs.core.Response createSse(CompositeResource.CreateCommandInvoker invoker) throws Exception
Exception
Copyright © 2019. All rights reserved.