Class AbstractJsonServerAction<T>
java.lang.Object
org.apache.struts2.ActionSupport
com.opensymphony.xwork2.ActionSupport
name.matthewgreet.strutscommons.action.AbstractActionSupport
name.matthewgreet.strutscommons.action.AbstractJsonServerAction<T>
- Type Parameters:
T
- Type to convert to JSON.
- All Implemented Interfaces:
com.opensymphony.xwork2.Action
,com.opensymphony.xwork2.interceptor.ValidationAware
,com.opensymphony.xwork2.LocaleProvider
,com.opensymphony.xwork2.TextProvider
,com.opensymphony.xwork2.Validateable
,Serializable
,BrowserTabAware
,BrowserTabAware2
,org.apache.struts2.action.Action
,org.apache.struts2.action.ServletRequestAware
,org.apache.struts2.action.ServletResponseAware
,org.apache.struts2.interceptor.ValidationAware
,org.apache.struts2.Validateable
public abstract class AbstractJsonServerAction<T>
extends AbstractActionSupport
implements org.apache.struts2.action.ServletResponseAware
Template class of Struts 2 action for serving Json data of generic type T, usually for JQuery-based pages using jQuery.getJSON.
The following is an example for generic type T:
public static class ProcessParamItem { @JsonProperty("value") private String value; public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String toString() { return "ProcessParamItem [value=" + value + "]"; } }
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.opensymphony.xwork2.interceptor.ValidationAware
com.opensymphony.xwork2.interceptor.ValidationAware.LegacyAdapter
-
Field Summary
Fields inherited from class org.apache.struts2.ActionSupport
container
Fields inherited from interface org.apache.struts2.action.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute()
protected String
Can be overridden to set execute result if it fails.javax.servlet.http.HttpServletResponse
protected abstract T
void
withServletResponse
(javax.servlet.http.HttpServletResponse response) Methods inherited from class name.matthewgreet.strutscommons.action.AbstractActionSupport
getBrowserTabSession, getServletRequest, getTabId, setBrowserTabSession, setTabId, withServletRequest
Methods inherited from class org.apache.struts2.ActionSupport
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, getActionErrors, getActionMessages, getContainer, getFieldErrors, getFormatted, getLocale, getLocaleProvider, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTextProvider, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, isValidLocale, isValidLocaleString, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors, toLocale, validate
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface name.matthewgreet.strutscommons.action.BrowserTabAware2
copyAttributesFromOldTabToNewTab, handleAttributeFailures
Methods inherited from interface org.apache.struts2.Validateable
validate
Methods inherited from interface org.apache.struts2.interceptor.ValidationAware
addActionError, addActionMessage, addFieldError, getActionErrors, getActionMessages, getFieldErrors, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, setActionErrors, setActionMessages, setFieldErrors
-
Constructor Details
-
AbstractJsonServerAction
public AbstractJsonServerAction()
-
-
Method Details
-
getErrorResultName
Can be overridden to set execute result if it fails. -
makeContent
- Throws:
Exception
-
execute
- Specified by:
execute
in interfaceorg.apache.struts2.action.Action
- Overrides:
execute
in classorg.apache.struts2.ActionSupport
- Throws:
Exception
-
getResponse
public javax.servlet.http.HttpServletResponse getResponse() -
withServletResponse
public void withServletResponse(javax.servlet.http.HttpServletResponse response) - Specified by:
withServletResponse
in interfaceorg.apache.struts2.action.ServletResponseAware
-