Class AbstractActionSupport

  • All Implemented Interfaces:
    com.opensymphony.xwork2.Action, com.opensymphony.xwork2.interceptor.ValidationAware, com.opensymphony.xwork2.LocaleProvider, com.opensymphony.xwork2.ModelDriven<KActionContext>, com.opensymphony.xwork2.Preparable, com.opensymphony.xwork2.TextProvider, com.opensymphony.xwork2.Validateable, Serializable, org.apache.struts2.interceptor.ServletResponseAware
    Direct Known Subclasses:
    ListAutocompleteAction

    public abstract class AbstractActionSupport
    extends com.opensymphony.xwork2.ActionSupport
    implements com.opensymphony.xwork2.ModelDriven<KActionContext>, com.opensymphony.xwork2.Preparable, org.apache.struts2.interceptor.ServletResponseAware
    Super class des Actions struts.
    Author:
    npiedeloup
    See Also:
    Serialized Form
    • Field Detail

      • CONTEXT_COLLECTION_NAME

        public static final String CONTEXT_COLLECTION_NAME
        Clé de la collection des contexts dans le KVStoreManager.
        See Also:
        Constant Field Values
      • MODE_EDIT_CONTEXT_KEY

        public static final String MODE_EDIT_CONTEXT_KEY
        Clé de context du mode Edit.
        See Also:
        Constant Field Values
      • MODE_READ_ONLY_CONTEXT_KEY

        public static final String MODE_READ_ONLY_CONTEXT_KEY
        Clé de context du mode ReadOnly.
        See Also:
        Constant Field Values
      • MODE_CREATE_CONTEXT_KEY

        public static final String MODE_CREATE_CONTEXT_KEY
        Clé de context du mode Create.
        See Also:
        Constant Field Values
      • URL_PARAM_PREFIX

        public static final String URL_PARAM_PREFIX
        Préfix des clés des paramètres passés par l'url.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractActionSupport

        protected AbstractActionSupport()
        Constructeur.
    • Method Detail

      • bindCtxToSession

        protected boolean bindCtxToSession()
        Lock context to sessionId. Should be desactivated by devs for sessionLess actions.
        Returns:
        if ctx is bind to session
      • contextMiss

        protected void contextMiss​(String ctxId)
                            throws ExpiredContextException
        Appeler lorsque que le context est manquant. Par défaut lance une ExpiredContextException. Mais une action spécifique pourrait reconstruire le context si c'est pertinent.
        Parameters:
        ctxId - Id du context manquant (seule info disponible)
        Throws:
        ExpiredContextException - Context expiré (comportement standard)
      • initContext

        protected abstract void initContext()
        Initialisation du context. Pour accepter initContext avec des paramètres de la request, il est possible de le faire avec ce code : final RequestContainerWrapper container = new RequestContainerWrapper(ServletActionContext.getRequest()); MethodUtil.invoke(this, "initContext", container);
      • preInitContext

        protected void preInitContext()
        Preinitialisation du context, pour ajouter les composants standard. Si surcharger doit rappeler le super.preInitContext();
      • storeContext

        public final void storeContext()
        Conserve et fige le context. Utilisé par le KActionContextStoreInterceptor.
      • execute

        @GET
        public String execute()
        Specified by:
        execute in interface com.opensymphony.xwork2.Action
        Overrides:
        execute in class com.opensymphony.xwork2.ActionSupport
      • validate

        public final void validate()
        Specified by:
        validate in interface com.opensymphony.xwork2.Validateable
        Overrides:
        validate in class com.opensymphony.xwork2.ActionSupport
      • getModel

        public final KActionContext getModel()
        Specified by:
        getModel in interface com.opensymphony.xwork2.ModelDriven<KActionContext>
      • toModeEdit

        protected final void toModeEdit()
        Passe en mode edition.
      • toModeCreate

        protected final void toModeCreate()
        Passe en mode creation.
      • toModeReadOnly

        protected final void toModeReadOnly()
        Passe en mode readonly.
      • isModeEdit

        protected final boolean isModeEdit()
        Returns:
        Si on est en mode edition
      • isModeRead

        protected final boolean isModeRead()
        Returns:
        Si on est en mode readOnly
      • isModeCreate

        protected final boolean isModeCreate()
        Returns:
        Si on est en mode create
      • createAjaxResponseBuilder

        public final AjaxResponseBuilder createAjaxResponseBuilder()
        Returns:
        AjaxResponseBuilder pour les requetes Ajax
      • createVFileResponseBuilder

        public final VFileResponseBuilder createVFileResponseBuilder()
        Returns:
        VFileResponseBuilder pour l'envoi de fichier
      • getUiMessageStack

        public final StrutsUiMessageStack getUiMessageStack()
        Returns:
        Pile des messages utilisateur.
      • setServletResponse

        public final void setServletResponse​(javax.servlet.http.HttpServletResponse servletResponse)
        Specified by:
        setServletResponse in interface org.apache.struts2.interceptor.ServletResponseAware
      • addActionMessage

        @Deprecated
        public final void addActionMessage​(String message)
        Deprecated.
        Utiliser getUiMessageStack()
        Specified by:
        addActionMessage in interface com.opensymphony.xwork2.interceptor.ValidationAware
        Overrides:
        addActionMessage in class com.opensymphony.xwork2.ActionSupport
      • addActionError

        @Deprecated
        public final void addActionError​(String message)
        Deprecated.
        Utiliser getUiMessageStack()
        Specified by:
        addActionError in interface com.opensymphony.xwork2.interceptor.ValidationAware
        Overrides:
        addActionError in class com.opensymphony.xwork2.ActionSupport
      • addFieldError

        @Deprecated
        public final void addFieldError​(String fieldName,
                                        String errorMessage)
        Deprecated.
        Utiliser getUiMessageStack()
        Specified by:
        addFieldError in interface com.opensymphony.xwork2.interceptor.ValidationAware
        Overrides:
        addFieldError in class com.opensymphony.xwork2.ActionSupport