Package org.apache.struts2.rest
Class RestActionInvocation
java.lang.Object
org.apache.struts2.DefaultActionInvocation
org.apache.struts2.rest.RestActionInvocation
- All Implemented Interfaces:
ActionInvocation
Extends the usual
ActionInvocation
to add support for processing the object returned
from the action execution. This allows us to support methods that return HttpHeaders
as well as apply content type-specific operations to the result.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected HttpHeaders
protected boolean
protected Object
Fields inherited from class org.apache.struts2.DefaultActionInvocation
action, actionEventListener, asyncAction, asyncManager, container, executed, explicitResult, extraContext, interceptors, invocationContext, lazyParamInjector, objectFactory, ognlUtil, preResultListeners, proxy, pushAction, result, resultCode, stack, unknownHandlerManager, valueStackFactory
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
RestActionInvocation
(Map<String, Object> extraContext, boolean pushAction) -
Method Summary
Modifier and TypeMethodDescriptioninvoke()
protected void
protected String
saveResult
(ActionConfig actionConfig, Object methodResult) Save the result to be used later.protected void
void
setDefaultErrorResultName
(String defaultErrorResultName) void
void
void
setRestrictToGet
(String restrictToGet) If set to true (by default) blocks returning content from any other methods than GET, if set to false, the content can be returned for any kind of methodprotected void
Get the status code from HttpHeaderResult and it is saved in the HttpHeaders object.Methods inherited from class org.apache.struts2.DefaultActionInvocation
addPreResultListener, createAction, createContextMap, createInterceptors, createResult, executeConditional, getAction, getInvocationContext, getProxy, getResult, getResultCode, getStack, init, invokeAction, invokeActionOnly, isExecuted, prepareLazyParamInjector, setActionEventListener, setAsyncManager, setContainer, setObjectFactory, setOgnlUtil, setResultCode, setUnknownHandlerManager, setValueStackFactory
-
Field Details
-
httpHeaders
-
target
-
isFirstInterceptor
protected boolean isFirstInterceptor -
hasErrors
protected boolean hasErrors
-
-
Constructor Details
-
RestActionInvocation
-
-
Method Details
-
setLogger
-
setDefaultErrorResultName
-
setRestrictToGet
If set to true (by default) blocks returning content from any other methods than GET, if set to false, the content can be returned for any kind of method- Parameters:
restrictToGet
- true or false
-
setMimeTypeHandlerSelector
-
saveResult
Save the result to be used later.- Overrides:
saveResult
in classDefaultActionInvocation
- Parameters:
actionConfig
- current ActionConfigmethodResult
- the result of the action.- Returns:
- the result code to process.
- Throws:
ConfigurationException
- If it is an incorrect result.
-
invoke
- Specified by:
invoke
in interfaceActionInvocation
- Overrides:
invoke
in classDefaultActionInvocation
- Throws:
Exception
-
processResult
- Throws:
Exception
-
updateStatusFromResult
protected void updateStatusFromResult()Get the status code from HttpHeaderResult and it is saved in the HttpHeaders object. -
selectTarget
protected void selectTarget()
-