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 booleanprotected HttpHeadersprotected booleanprotected ObjectFields 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
ConstructorsModifierConstructorDescriptionprotectedRestActionInvocation(Map<String, Object> extraContext, boolean pushAction) -
Method Summary
Modifier and TypeMethodDescriptioninvoke()protected voidprotected StringsaveResult(ActionConfig actionConfig, Object methodResult) Save the result to be used later.protected voidvoidsetDefaultErrorResultName(String defaultErrorResultName) voidvoidvoidsetRestrictToGet(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 voidGet 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:
saveResultin 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:
invokein interfaceActionInvocation- Overrides:
invokein 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()
-