public class ERXRouteController extends WODirectAction
Name | Description |
---|---|
ERXRest.accessControlAllowRequestHeaders | See https://developer.mozilla.org/En/HTTP_access_control#Access-Control-Allow-Headers |
ERXRest.accessControlAllowRequestMethods | See https://developer.mozilla.org/En/HTTP_access_control#Access-Control-Allow-Methods |
ERXRest.defaultFormat | (default "xml") Allow you to set the default format for all of your REST controllers |
ERXRest.strictMode | (default "true") If set to true, status code in the response will be 405 Not Allowed, if set to false, status code will be 404 Not Found |
ERXRest.allowWindowNameCrossDomainTransport | ERXRest.allowWindowNameCrossDomainTransport |
ERXRest.accessControlMaxAge | (default 1728000) This header indicates how long the results of a preflight request can be cached. See https://developer.mozilla.org/En/HTTP_access_control#Access-Control-Max-Age |
ERXRest.accessControlAllowOrigin | Set the value to '*' to enable all origins. See https://developer.mozilla.org/En/HTTP_access_control#Access-Control-Allow-Origin |
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
NSValidation._MethodBinding, NSValidation._ValidationBinding, NSValidation.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException
actionText
_actionClasses, _context
_CLASS
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
NullValue
_CLASS
Constructor and Description |
---|
ERXRouteController(WORequest request)
Constructs a new ERXRouteController.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
_canSetHeaderForActionResults(WOActionResults results)
Returns whether or not headers can be added to the given action results.
|
static NSMutableArray<ERXRouteController> |
_controllersForRequest(WORequest request)
Returns the controllers that have been used on the given request.
|
static void |
_disposeControllersForRequest(WORequest request)
Disposes all of the controllers that were used on the given request.
|
protected static void |
_registerControllerForRequest(ERXRouteController controller,
WORequest request)
Registers the given controller with the given request, so it can be later disposed.
|
void |
_setContext(WOContext context)
WODirectAction doesn't expose API for setting the context, which can be useful for passing data between controller.
|
void |
_setEditingContent(EOEditingContext ec) |
void |
_setEntityName(String entityName)
Sets the entity name for this controller.
|
void |
_setFormat(ERXRestFormat format)
Sets the format that will be used by this route controller.
|
protected void |
_setHeaderForActionResults(String value,
String key,
WOActionResults results)
Attempt to set the header for the given results object.
|
void |
_setRequestContent(ERXRestFormat format,
String requestContent)
Sets the request content that this controller will use for processing.
|
void |
_setRequestContent(String requestContent)
Sets the request content that this controller will use for processing -- this requires that a format() is specified.
|
void |
_setRequestHandler(ERXRouteRequestHandler requestHandler)
Sets the request handler that processed this route.
|
void |
_setRequestNode(ERXRestRequestNode requestNode)
Sets the request node that this controller will use for processing.
|
void |
_setRoute(ERXRoute route)
Sets the route that is associated with this request.
|
void |
_setRouteKeys(NSDictionary<ERXRoute.Key,String> routeKeys)
Sets the unprocessed keys from the route.
|
void |
_setRouteObjects(NSDictionary<ERXRoute.Key,Object> objects)
Sets the processed objects for the current route.
|
protected void |
_takeRouteParametersFromRequest(WOActionResults results)
Enumerates the route keys, looks for @ERXRouteParameter annotated methods, and sets the value of the routeKey
with the corresponding method if it exists.
|
protected String |
accessControlAllowOrigin()
Returns the allowed origin for cross-site requests.
|
protected NSArray<String> |
accessControlAllowRequestHeaders(NSArray<String> requestHeaders)
Returns the allowed request headers given the requested headers.Set the property ERXRest.accessControlAllowRequestHeaders to override
the default of just returning the requested headers.
|
protected NSArray<String> |
accessControlAllowRequestMethods(String requestMethod)
Returns the allowed request methods given the requested method.
|
protected long |
accessControlMaxAage()
Returns the maximum age in seconds for the preflight options cache.
|
protected boolean |
allowJSONP()
Returns whether or not JSONP (JSON with Padding) is allowed.
|
protected boolean |
allowWindowNameCrossDomainTransport()
Returns whether or not the window.name cross-domain transport is allowed.
|
protected void |
checkAccess()
Override to provide custom security checks.
|
boolean |
containsRouteKey(String key)
Returns whether or not there is a route key with the given name.
|
<T extends ERXRouteController> |
controller(Class<T> controllerClass)
Returns another controller, passing the required state on.
|
<T extends ERXRouteController> |
controller(String entityName)
Returns another controller, passing the required state on.
|
<T> T |
create(ERXKeyFilter filter)
Creates a new object from the request data that is of the routed entity name and is filtered with the given
filter.
|
<T> T |
create(ERXKeyFilter filter,
ERXRestContext restContext)
Creates a new object from the request data that is of the routed entity name and is filtered with the given
filter.
|
<T> T |
create(String entityName,
ERXKeyFilter filter)
Creates a new object from the request data that is of the given entity name and is filtered with the given
filter.
|
<T> T |
create(String entityName,
ERXKeyFilter filter,
ERXRestContext restContext)
Creates a new object from the request data that is of the given entity name and is filtered with the given
filter.
|
protected ERXRestContext |
createRestContext()
Creates a new rest context for the controller.
|
protected ERXRestFormat |
defaultFormat()
Returns the default format to use if no other format is found, or if the requested format is invalid.
|
void |
dispose()
Disposes any resources the route controller may be holding onto (like its editing context).
|
EOEditingContext |
editingContext()
The controller maintains an editing context for the duration of the request.
|
protected String |
entityName()
Returns the name of the entity that this controller is currently handling.
|
WOActionResults |
errorResponse(int status)
Returns an error response with the given HTTP status and without any body content
|
WOActionResults |
errorResponse(String errorMessage,
int status)
Returns an error response with the given HTTP status.
|
WOActionResults |
errorResponse(Throwable t,
int status)
Returns an error response with the given HTTP status.
|
ERXRestFormat |
format()
Returns the format that the user requested (usually based on the request file extension).
|
protected ERXRestFormat.Delegate |
formatDelegateForFormat(ERXRestFormat format)
Returns the default format delegate to use for the given format (defaults to format.delegate()).
|
protected ERXRestFormat |
formatNamed(String type)
Returns the format to use for the given type (see ERXRestFormat constants).
|
WOActionResults |
headAction()
Returns the response from a HEAD call to this controller.
|
protected ERXKeyFilter |
includeOptional(ERXKey<?> key,
ERXKeyFilter filter)
Includes the key in the given filter if isKeyPathRequested returns true.
|
protected boolean |
isAutomaticHtmlRoutingEnabled()
If this method returns true, all HTML format requests will be automatically routed to the corresponding
IERXRouteComponent implementation based on the name returned by pageNameForAction(String).
|
protected boolean |
isKeyPathRequested(ERXKey<?> key)
Returns whether or not the prefetchingKeyPaths option includes the given keypath (meaning, the client requested
to include the given keypath).
|
protected boolean |
isKeyPathRequested(String keyPath)
Returns whether or not the prefetchingKeyPaths option includes the given keypath (meaning, the client requested
to include the given keypath).
|
protected boolean |
isSchemaRequest()
Returns whether or not this request is for a schema.
|
WOActionResults |
json(EOClassDescription entity,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as a JSON response.
|
WOActionResults |
json(EOEditingContext editingContext,
String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as a JSON response.
|
WOActionResults |
json(Object value,
ERXKeyFilter filter)
Returns the given object as a JSON response.
|
WOActionResults |
json(String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as a JSON response.
|
protected EOEditingContext |
newEditingContext()
Creates a new editing context.
|
protected EOEditingContext |
newEditingContext(EOObjectStore objectStore)
Creates a new editing context with a parent object store.
|
<T> T |
object(ERXKeyFilter filter)
Returns the object from the request data that is of the routed entity name and is filtered with the given filter.
|
<T> T |
object(ERXKeyFilter filter,
ERXRestContext restContext)
Returns the object from the request data that is of the routed entity name and is filtered with the given filter.
|
<T> T |
object(String entityName,
ERXKeyFilter filter)
Returns the object from the request data that is of the given entity name and is filtered with the given filter.
|
<T> T |
object(String entityName,
ERXKeyFilter filter,
ERXRestContext restContext)
Returns the object from the request data that is of the given entity name and is filtered with the given filter.
|
NSKeyValueCoding |
options()
Returns the options for this controller.
|
WOActionResults |
optionsAction()
A default options action that implements access control policy.
|
protected String |
pageNameForAction(String actionName)
Returns the name of the page component for this entity and the given action.
|
<T extends WOComponent> |
pageWithName(Class<T> componentClass)
Calls pageWithName.
|
WOActionResults |
performActionNamed(String actionName) |
WOActionResults |
performActionNamed(String actionName,
boolean throwExceptions)
Performs the given action, optionally throwing exceptions instead of converting to http response codes.
|
protected WOActionResults |
performActionNamedWithError(String actionName,
Throwable t)
Called when performing an action fails, giving a chance to return an appropriate error result.
|
protected WOActionResults |
performActionWithAnnotations(Method actionMethod,
List<Annotation> parameterAnnotations)
Called when performRouteAction dispatches a method that uses parameter annotations.
|
protected WOActionResults |
performActionWithArguments(Method actionMethod,
Object... args)
Called when an action method is dispatched by performRouteAction in any form.
|
protected WOActionResults |
performHtmlActionNamed(String actionName)
If automatic HTML routing is enabled and this request used an HTML format, this method is called
to dispatch the HTML action.
|
protected WOActionResults |
performRouteActionNamed(String actionName)
If this request is for a normal route action, this method is called to dispatch it.
|
protected WOActionResults |
performUnknownAction(String actionName)
Called when no standard action method can be found to handle the requested route.
|
WOActionResults |
plist(EOClassDescription entity,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as a JSON response.
|
WOActionResults |
plist(EOEditingContext editingContext,
String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as a JSON response.
|
WOActionResults |
plist(Object value,
ERXKeyFilter filter)
Returns the given object as a PList response.
|
WOActionResults |
plist(String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as a PList response.
|
protected WOActionResults |
processActionResults(WOActionResults results)
Before returning the action results, this method is called to perform any last minute processing.
|
ERXRouteRequestHandler |
requestHandler()
Returns the request handler that processed this route.
|
ERXRestRequestNode |
requestNode()
Returns the request data in the form of an ERXRestRequestNode (which is a format-independent wrapper around
hierarchical data).
|
WOActionResults |
response(EOClassDescription entity,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as an response in the format returned from the format() method.
|
WOActionResults |
response(EOEditingContext editingContext,
String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as an response in the format returned from the format() method.
|
WOActionResults |
response(ERXRestFetchSpecification<?> fetchSpec,
ERXKeyFilter filter)
Returns the results of the rest fetch spec as an response in the format returned from the format() method.
|
WOActionResults |
response(ERXRestFormat format,
EOClassDescription entity,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as a response in the given format.
|
WOActionResults |
response(ERXRestFormat format,
EOEditingContext editingContext,
String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as a response in the given format.
|
WOActionResults |
response(ERXRestFormat format,
ERXRestRequestNode responseNode)
Returns the given ERXRestRequestNode as a response in the given format.
|
WOActionResults |
response(ERXRestFormat format,
Object value,
ERXKeyFilter filter)
Returns the given object as a WOResponse in the given format.
|
WOActionResults |
response(ERXRestFormat format,
String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as a response in the given format.
|
WOActionResults |
response(int status)
Returns an response with the given HTTP status and without any body content.
|
WOActionResults |
response(Object value,
ERXKeyFilter filter)
Returns the given object as a response in the format returned from the format() method.
|
WOActionResults |
response(String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as an response in the format returned from the format() method.
|
String |
responseContentForActionNamed(String actionName)
Returns the response content generated from performing the action with the given name.
|
ERXRestRequestNode |
responseNodeForActionNamed(String actionName)
Returns the response node generated from performing the action with the given name.
|
ERXRestContext |
restContext()
Returns the cached rest context for this controller.
|
ERXRoute |
route()
Returns the route associated with this request.
|
NSDictionary<ERXRoute.Key,String> |
routeKeys()
Returns the unprocessed keys from the route (the values are the original value from the URL).
|
<T> T |
routeObjectForKey(String key)
Returns the processed object from the route keys with the given name.
|
NSDictionary<ERXRoute.Key,Object> |
routeObjects()
Returns all the processed objects from the route keys.
|
NSDictionary<ERXRoute.Key,Object> |
routeObjects(ERXRestContext restContext)
Returns all the processed objects from the route keys.
|
String |
routeStringForKey(String key)
Returns the unprocessed value from the route with the given key name.
|
protected WOActionResults |
schemaResponse(ERXKeyFilter filter)
Returns the schema response for the current entity with the given filter.
|
protected WOActionResults |
schemaResponseForEntityNamed(String entityName,
ERXKeyFilter filter)
Returns the schema response for the given entity with the given filter.
|
void |
setOptions(NSKeyValueCoding options)
Sets the options for this controller.
|
void |
setRestContext(ERXRestContext restContext)
Sets the rest context for this controller.
|
protected boolean |
shouldFailOnMissingHtmlPage()
If automatic html routing is enabled and there is no page component found that matches the current route,
should that result in a 404?
|
WOResponse |
stringResponse(String str)
Returns the given string wrapped in a WOResponse.
|
String |
toString() |
void |
update(Object obj,
ERXKeyFilter filter)
Updates the given object from the request data with the given filter.
|
void |
update(Object obj,
ERXKeyFilter filter,
ERXRestContext restContext)
Updates the given object from the request data with the given filter.
|
WOActionResults |
xml(EOClassDescription entity,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as an XML response.
|
WOActionResults |
xml(EOEditingContext editingContext,
String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as an XML response.
|
WOActionResults |
xml(Object value,
ERXKeyFilter filter)
Returns the given object as an XML response.
|
WOActionResults |
xml(String entityName,
NSArray<?> values,
ERXKeyFilter filter)
Returns the given array as an XML response.
|
_componentAction, defaultAction, getSessionIDForRequest, takeFormValueArraysForKeyArray, takeFormValuesForKeyArray
_isActionOnClass, _methodForAction, _preloadAllActionsOnClass, canAccessFieldsDirectly, context, debugString, existingSession, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, initializeRequestSessionIDInContext, languages, logString, pageWithName, request, session, setLanguages, takeValueForKey, takeValueForKeyPath, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, valueForKey, valueForKeyPath
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
handleQueryWithUnboundKey, handleTakeValueForUnboundKey, unableToSetNullForKey
takeValueForKeyPath, valueForKeyPath
takeValueForKey, valueForKey
validateTakeValueForKeyPath, validateValueForKey
public ERXRouteController(WORequest request)
request
- the requestprotected ERXKeyFilter includeOptional(ERXKey<?> key, ERXKeyFilter filter)
key
- the key to lookupfilter
- the filter to include intoprotected boolean isKeyPathRequested(ERXKey<?> key)
key
- the ERXKey to check onprotected boolean isKeyPathRequested(String keyPath)
keyPath
- the keyPath to check onpublic void setOptions(NSKeyValueCoding options)
options
- options for this controllerpublic NSKeyValueCoding options()
public void _setContext(WOContext context)
context
- the new contextpublic void _setRequestHandler(ERXRouteRequestHandler requestHandler)
requestHandler
- the request handler that processed this routepublic ERXRouteRequestHandler requestHandler()
protected void checkAccess() throws SecurityException
SecurityException
- if the security check failspublic void _setEditingContent(EOEditingContext ec)
public EOEditingContext editingContext()
protected EOEditingContext newEditingContext()
protected EOEditingContext newEditingContext(EOObjectStore objectStore)
objectStore
- the parent object storepublic void _setRoute(ERXRoute route)
route
- the route that is associated with this controllerpublic ERXRoute route()
public void _setRouteKeys(NSDictionary<ERXRoute.Key,String> routeKeys)
routeKeys
- the parsed keys from the routepublic NSDictionary<ERXRoute.Key,String> routeKeys()
public String routeStringForKey(String key)
key
- the key name to lookuppublic boolean containsRouteKey(String key)
key
- the key name to lookuppublic <T> T routeObjectForKey(String key)
key
- the key name to lookuppublic void _setRouteObjects(NSDictionary<ERXRoute.Key,Object> objects)
objects
- the route objects to overridepublic NSDictionary<ERXRoute.Key,Object> routeObjects()
public NSDictionary<ERXRoute.Key,Object> routeObjects(ERXRestContext restContext)
restContext
- the delegate to fetch withprotected ERXRestFormat defaultFormat()
public void _setFormat(ERXRestFormat format)
format
- the format to be used by this route controllerpublic ERXRestFormat format()
protected ERXRestFormat formatNamed(String type)
type
- the type of format to useprotected ERXRestContext createRestContext()
public ERXRestContext restContext()
createRestContext()
to create a new instance.public void setRestContext(ERXRestContext restContext)
restContext
- the rest context for this controllerpublic void _setRequestContent(ERXRestFormat format, String requestContent)
format
- the requested formatrequestContent
- the content of the incoming requestpublic void _setRequestContent(String requestContent)
requestContent
- the content of the incoming requestpublic void _setRequestNode(ERXRestRequestNode requestNode)
requestNode
- the node reprsenting the incoming requestprotected ERXRestFormat.Delegate formatDelegateForFormat(ERXRestFormat format)
format
- the format to lookuppublic ERXRestRequestNode requestNode()
public <T> T object(ERXKeyFilter filter)
filter
- the filter to apply to the object for the purposes of updating (or null to not update)public <T> T object(String entityName, ERXKeyFilter filter)
entityName
- the entity name of the object in the requestfilter
- the filter to apply to the object for the purposes of updating (or null to not update)public <T> T object(ERXKeyFilter filter, ERXRestContext restContext)
filter
- the filter to apply to the object for the purposes of updating (or null to not update)restContext
- the delegate to usepublic <T> T object(String entityName, ERXKeyFilter filter, ERXRestContext restContext)
entityName
- the entity name of the object in the requestfilter
- the filter to apply to the object for the purposes of updating (or null to not update)restContext
- the delegate to usepublic <T> T create(ERXKeyFilter filter)
filter
- the filter to apply to the object for the purposes of updating (or null to just create a blank one)public <T> T create(String entityName, ERXKeyFilter filter)
entityName
- the entity name of the object in the requestfilter
- the filter to apply to the object for the purposes of updating (or null to just create a blank one)public <T> T create(ERXKeyFilter filter, ERXRestContext restContext)
filter
- the filter to apply to the object for the purposes of updating (or null to just create a blank one)restContext
- the delegate to usepublic <T> T create(String entityName, ERXKeyFilter filter, ERXRestContext restContext)
entityName
- the entity name of the object in the requestfilter
- the filter to apply to the object for the purposes of updating (or null to just create a blank one)restContext
- the delegate to usepublic void update(Object obj, ERXKeyFilter filter)
obj
- the object to updatefilter
- the filter to apply to the object for the purposes of updating (or null to not update)public void update(Object obj, ERXKeyFilter filter, ERXRestContext restContext)
obj
- object to updatefilter
- the filter to apply to the object for the purposes of updating (or null to not update)restContext
- delegate to usepublic WOResponse stringResponse(String str)
str
- the string to returnpublic WOActionResults json(String entityName, NSArray<?> values, ERXKeyFilter filter)
entityName
- the name of the entities in the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults json(EOEditingContext editingContext, String entityName, NSArray<?> values, ERXKeyFilter filter)
editingContext
- the editing context to useentityName
- the name of the entities in the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults json(EOClassDescription entity, NSArray<?> values, ERXKeyFilter filter)
entity
- the entity type of the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults plist(String entityName, NSArray<?> values, ERXKeyFilter filter)
entityName
- the name of the entities in the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults plist(EOEditingContext editingContext, String entityName, NSArray<?> values, ERXKeyFilter filter)
editingContext
- the editing context to useentityName
- the name of the entities in the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults plist(EOClassDescription entity, NSArray<?> values, ERXKeyFilter filter)
entity
- the entity type of the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults xml(String entityName, NSArray<?> values, ERXKeyFilter filter)
entityName
- the name of the entities in the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults xml(EOEditingContext editingContext, String entityName, NSArray<?> values, ERXKeyFilter filter)
editingContext
- the editing context to useentityName
- the name of the entities in the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults xml(EOClassDescription entity, NSArray<?> values, ERXKeyFilter filter)
entity
- the entity type of the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectsprotected boolean _canSetHeaderForActionResults(WOActionResults results)
results
- the results to testprotected void _setHeaderForActionResults(String value, String key, WOActionResults results)
value
- the valuekey
- the keyresults
- the results objectpublic WOActionResults response(ERXRestFetchSpecification<?> fetchSpec, ERXKeyFilter filter)
fetchSpec
- the rest fetch specification to executefilter
- the filter to apply to the objectspublic WOActionResults response(String entityName, NSArray<?> values, ERXKeyFilter filter)
entityName
- the name of the entities in the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults response(EOEditingContext editingContext, String entityName, NSArray<?> values, ERXKeyFilter filter)
editingContext
- the editing context to useentityName
- the name of the entities in the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults response(EOClassDescription entity, NSArray<?> values, ERXKeyFilter filter)
entity
- the entity type of the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults response(ERXRestFormat format, String entityName, NSArray<?> values, ERXKeyFilter filter)
format
- the format to useentityName
- the name of the entity type of the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults response(ERXRestFormat format, EOEditingContext editingContext, String entityName, NSArray<?> values, ERXKeyFilter filter)
format
- the format to useeditingContext
- the editing context to useentityName
- the name of the entities in the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults response(ERXRestFormat format, EOClassDescription entity, NSArray<?> values, ERXKeyFilter filter)
format
- the format to useentity
- the entity type of the arrayvalues
- the values in the arrayfilter
- the filter to apply to the objectspublic WOActionResults response(ERXRestFormat format, ERXRestRequestNode responseNode)
format
- the format to useresponseNode
- the request node to renderpublic WOActionResults json(Object value, ERXKeyFilter filter)
value
- the value to returnfilter
- the filter to applypublic WOActionResults plist(Object value, ERXKeyFilter filter)
value
- the value to returnfilter
- the filter to applypublic WOActionResults xml(Object value, ERXKeyFilter filter)
value
- the value to returnfilter
- the filter to applypublic WOActionResults response(Object value, ERXKeyFilter filter)
value
- the value to returnfilter
- the filter to applypublic WOActionResults response(ERXRestFormat format, Object value, ERXKeyFilter filter)
format
- the format to usevalue
- the value to returnfilter
- the filter to applypublic WOActionResults response(int status)
status
- the HTTP status codepublic WOActionResults errorResponse(Throwable t, int status)
t
- the exceptionstatus
- the HTTP status codepublic WOActionResults errorResponse(String errorMessage, int status)
errorMessage
- the error messagestatus
- the HTTP status codepublic WOActionResults errorResponse(int status)
status
- the HTTP status codepublic WOActionResults headAction()
protected void _takeRouteParametersFromRequest(WOActionResults results)
results
- the results to apply route parameter toprotected boolean isAutomaticHtmlRoutingEnabled()
protected boolean shouldFailOnMissingHtmlPage()
public void _setEntityName(String entityName)
entityName
- this controller's entity nameprotected String entityName()
protected String pageNameForAction(String actionName)
actionName
- the name of the actionprotected WOActionResults performUnknownAction(String actionName) throws Exception
actionName
- the unknown action nameException
public WOActionResults performActionNamed(String actionName)
performActionNamed
in class WODirectAction
public ERXRestRequestNode responseNodeForActionNamed(String actionName)
actionName
- the name of the action to performpublic String responseContentForActionNamed(String actionName)
actionName
- the name of the action to performpublic WOActionResults performActionNamed(String actionName, boolean throwExceptions) throws RuntimeException
actionName
- the name of the action to performthrowExceptions
- whether or not to throw exceptionsRuntimeException
- if a failure occursprotected WOActionResults performHtmlActionNamed(String actionName) throws Exception
actionName
- the name of the HTML actionException
- if anything failsprotected WOActionResults performRouteActionNamed(String actionName) throws Exception
actionName
- the name of the action to performException
- if anything failsprotected WOActionResults performActionWithAnnotations(Method actionMethod, List<Annotation> parameterAnnotations) throws Exception
actionMethod
- the action method to dispatchparameterAnnotations
- the list of annotationsException
- if anything failsprotected WOActionResults performActionWithArguments(Method actionMethod, Object... args) throws Exception
actionMethod
- the method to invokeargs
- the arguments to pass to the methodException
- if anything failsprotected WOActionResults performActionNamedWithError(String actionName, Throwable t)
actionName
- the name of the action that attempted to performt
- the error that occurredprotected WOActionResults processActionResults(WOActionResults results)
results
- protected boolean allowWindowNameCrossDomainTransport()
protected boolean allowJSONP()
protected String accessControlAllowOrigin()
protected NSArray<String> accessControlAllowRequestMethods(String requestMethod)
requestMethod
- the requested methodprotected NSArray<String> accessControlAllowRequestHeaders(NSArray<String> requestHeaders)
requestHeaders
- the requested headersprotected long accessControlMaxAage()
public WOActionResults optionsAction() throws Throwable
Throwable
public <T extends WOComponent> T pageWithName(Class<T> componentClass)
T
- the type of component to returncomponentClass
- the component class to lookuppublic <T extends ERXRouteController> T controller(String entityName)
T
- the type of controller to returnentityName
- the entity name of the controller to lookuppublic <T extends ERXRouteController> T controller(Class<T> controllerClass)
T
- the type of controller to returncontrollerClass
- the controller class to lookuppublic void dispose()
protected boolean isSchemaRequest()
protected WOActionResults schemaResponse(ERXKeyFilter filter)
filter
- the filter to applyprotected WOActionResults schemaResponseForEntityNamed(String entityName, ERXKeyFilter filter)
entityName
- the entity namefilter
- the filter to applyprotected static void _registerControllerForRequest(ERXRouteController controller, WORequest request)
controller
- the controller to registerrequest
- the request to register withpublic static NSMutableArray<ERXRouteController> _controllersForRequest(WORequest request)
request
- the requestpublic static void _disposeControllersForRequest(WORequest request)
request
- the requestCopyright © 2002 – 2024 Project Wonder.