|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mentawai.core.BaseAction
public abstract class BaseAction
The abstract base implementation of a Mentawai action. It also privides access to input, output, session context and application context through protected data members.
| Field Summary | |
|---|---|
protected Context |
application
|
protected Context |
cookies
|
protected Input |
input
|
protected Locale |
loc
|
protected MessageContext |
msgContext
|
protected Output |
output
|
protected Context |
session
|
| Fields inherited from interface org.mentawai.core.Action |
|---|
ACCESSDENIED, ADD, AJAX, ALREADY, BACK, BLOCKED, CREATED, EDIT, ERROR, EXCEPTION, HTML, INDEX, JSON, JSP, LIST, LOGIN, MAIN, NEXT, NULL, REMOVED, SHOW, STREAM, SUCCESS, TEST, UPDATED, XML |
| Constructor Summary | |
|---|---|
BaseAction()
Creates a BaseAction. |
|
| Method Summary | ||
|---|---|---|
void |
addError(int error_id)
Adds an error to the action with the given number. |
|
void |
addError(int error_id,
MessageContext msgContext)
Adds an error to the action with the given number and context. |
|
void |
addError(Message error)
Adds an error to the action. |
|
void |
addError(String error_id)
Adds an error to the action with the given number. |
|
void |
addError(String field,
int error_id)
Adds an error to the action with the given number for the given field. |
|
void |
addError(String field,
int error_id,
MessageContext msgContext)
Adds an error to the action with the given number and context for the given field. |
|
void |
addError(String error_id,
Map<String,String> tokens)
|
|
void |
addError(String field,
Message error)
Adds an error to the action for the given field. |
|
void |
addError(String error_id,
MessageContext msgContext)
Adds an error to the action with the given number and context. |
|
void |
addError(String field,
String error_id)
Adds an error to the action with the given number for the given field. |
|
void |
addError(String field,
String error_id,
Map<String,String> tokens)
|
|
void |
addError(String field,
String error_id,
MessageContext msgContext)
Adds an error to the action with the given number and context for the given field. |
|
void |
addMessage(int msg_id)
Adds a message to the action with the given number. |
|
void |
addMessage(int msg_id,
boolean flash)
|
|
void |
addMessage(int msg_id,
MessageContext msgContext)
Adds a message to the action with the given number and context. |
|
void |
addMessage(int msg_id,
MessageContext msgContext,
boolean flash)
|
|
void |
addMessage(Message msg)
Adds an message to the action. |
|
void |
addMessage(Message msg,
boolean flash)
|
|
void |
addMessage(String msg_id)
Adds a message to the action with the given number. |
|
void |
addMessage(String msg_id,
boolean flash)
|
|
void |
addMessage(String msg_id,
Map<String,String> tokens)
|
|
void |
addMessage(String msg_id,
Map<String,String> tokens,
boolean flash)
|
|
void |
addMessage(String msg_id,
MessageContext msgContext)
Adds a message to the action with the given number and context. |
|
void |
addMessage(String msg_id,
MessageContext msgContext,
boolean flash)
|
|
void |
adhere()
Adhere to the session, so the instance of this action will persist until disjoin is called. |
|
void |
ajax(Object value)
Shortcut for output.setValue(AjaxConsequence.KEY, value) |
|
Context |
application()
|
|
void |
commit()
|
|
void |
commit(String trans)
|
|
Context |
cookies()
|
|
void |
disjoin()
Remove this action from session and discard its instance losing all state (instance variables) associated with it. |
|
String |
execute()
|
|
Object |
findValue(String key)
|
|
static Object |
findValue(String key,
Action action)
|
|
Context |
getApplication()
Gets this action application context. |
|
String |
getContextPath()
|
|
Context |
getCookies()
Gets the cookie context for this action. |
|
String |
getError(String field)
|
|
Input |
getInput()
Gets the action input. |
|
Locale |
getLocale()
Gets the use locale for this action. |
|
static Map<String,String> |
getMessageTokens(Action action,
String field)
|
|
protected Map<String,String> |
getMessageTokens(String field)
This method will generate dynamic tokens for the success/error messages (dynamic messages). |
|
Output |
getOutput()
Gets the action output. |
|
Context |
getSession()
Gets this action session context. |
|
Locale |
getSessionLocale()
|
|
|
getSessionObj()
|
|
Locale |
getUserLocale()
|
|
|
getUserSession()
|
|
protected boolean |
hasError()
Checks if any error has been thrown into the action. |
|
void |
init()
|
|
static void |
init(Action action)
|
|
Input |
input()
|
|
boolean |
isEmpty(String s)
|
|
boolean |
isGet()
|
|
static boolean |
isGet(Action action)
|
|
boolean |
isLogged()
|
|
boolean |
isPost()
|
|
static boolean |
isPost(Action action)
|
|
Locale |
loc()
|
|
void |
onRemoved()
This method will be called if the session has expired or if it has been invalidated and there are sticky actions still sticked to the session. |
|
Output |
output()
|
|
void |
redir(String url)
Shortcut for output.setValue(Redirect.REDIRURL_PARAM, "url"); Use redir() consequence for ActionConfig Example: In Action: redir("some.jsp?someparam=somevalue"); In ApplicationManager: action("someAction.mtw").redir(); |
|
void |
replaceSessionObj(Object newUser)
|
|
void |
replaceUserSession(Object newUser)
|
|
void |
rollback()
|
|
void |
rollback(String trans)
|
|
Context |
session()
|
|
void |
setApplication(Context context)
Sets the application context for this action. |
|
void |
setCookies(Context context)
Sets the cookie context for this action. |
|
void |
setInput(Input input)
Sets the input for this action. |
|
void |
setLocale(Locale loc)
Sets the user locale for this action. |
|
static void |
setMessageContext(MessageContext msgContext)
Sets a fixed message context for all actions derived from BaseAction. |
|
void |
setOutput(Output output)
Sets the output for this action. |
|
void |
setSession(Context context)
Sets the session context for this action. |
|
void |
setSessionGroup(Enum<?> e)
|
|
void |
setSessionGroup(String group)
|
|
void |
setSessionGroups(Enum<?>... es)
|
|
void |
setSessionGroups(String... groups)
|
|
void |
setSessionLocale(Locale loc)
|
|
void |
setSessionLocale(String locale)
|
|
void |
setSessionObj(Object user)
|
|
void |
setSessionUser(Object user)
|
|
void |
setUserSession(Object user)
|
|
void |
stream(Object value)
|
|
void |
stream(Object value,
int length)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected MessageContext msgContext
protected Input input
protected Output output
protected Context session
protected Context application
protected Context cookies
protected Locale loc
| Constructor Detail |
|---|
public BaseAction()
| Method Detail |
|---|
public static void init(Action action)
public void init()
public boolean isEmpty(String s)
public void commit()
throws Exception
Exception
public void commit(String trans)
throws Exception
Exception
public void rollback()
throws Exception
Exception
public void rollback(String trans)
throws Exception
Exceptionpublic boolean isPost()
public boolean isGet()
public static boolean isPost(Action action)
public static boolean isGet(Action action)
public static void setMessageContext(MessageContext msgContext)
msgContext - The message context to use for all actions.protected boolean hasError()
public static Map<String,String> getMessageTokens(Action action,
String field)
protected Map<String,String> getMessageTokens(String field)
field - The field to which the tokens refer to (you can pass null if the tokens do not refer to any field in particular
public void addMessage(String msg_id)
msg_id - The id of the message to show.
public void addMessage(String msg_id,
boolean flash)
public void addMessage(String msg_id,
Map<String,String> tokens)
public void addMessage(String msg_id,
Map<String,String> tokens,
boolean flash)
public void addMessage(int msg_id)
msg_id - The id of the message to show.
public void addMessage(int msg_id,
boolean flash)
public void addError(String error_id)
error_id - The id of the error to show.
public void addError(String error_id,
Map<String,String> tokens)
public void addError(int error_id)
error_id - The id of the error to show.
public void addError(String field,
String error_id)
field - The name of the field containing this error message.error_id - The id of the error to show.public String getError(String field)
public void addError(String field,
String error_id,
Map<String,String> tokens)
public void addError(String field,
int error_id)
field - The name of the field containing this error message.error_id - The id of the error to show.
public void addMessage(String msg_id,
MessageContext msgContext)
msg_id - The id of the message to show.msgContext - The MessageContext where the message is.
public void addMessage(String msg_id,
MessageContext msgContext,
boolean flash)
public void addMessage(int msg_id,
MessageContext msgContext)
msg_id - The id of the message to show.msgContext - The MessageContext where the message is.
public void addMessage(int msg_id,
MessageContext msgContext,
boolean flash)
public void addError(String error_id,
MessageContext msgContext)
error_id - The id of the error to show.msgContext - The MessageContext where the error is.
public void addError(int error_id,
MessageContext msgContext)
error_id - The id of the error to show.msgContext - The MessageContext where the error is.
public void addError(String field,
String error_id,
MessageContext msgContext)
field - The name of the field containing this error message.error_id - The id of the error to show.msgContext - The MessageContext where the error is.
public void addError(String field,
int error_id,
MessageContext msgContext)
field - The name of the field containing this error message.error_id - The id of the error to show.msgContext - The MessageContext where the error is.public void addMessage(Message msg)
msg - The message object.
public void addMessage(Message msg,
boolean flash)
public void addError(Message error)
error - The error object.
public void addError(String field,
Message error)
field - The name of the field containing this error message.error - The error object.public void setInput(Input input)
Action
setInput in interface Actioninput - the input to be setpublic void setOutput(Output output)
Action
setOutput in interface Actionoutput - the output to be setpublic void setSession(Context context)
Action
setSession in interface Actioncontext - The context to be setpublic void setApplication(Context context)
Action
setApplication in interface Actioncontext - The context to be setpublic void setCookies(Context context)
Action
setCookies in interface Actioncontext - The cookie context to be setpublic void setLocale(Locale loc)
Action
setLocale in interface Actionloc - The user locale to set.public Input getInput()
Action
getInput in interface Actionpublic Output getOutput()
Action
getOutput in interface Actionpublic Context getSession()
Action
getSession in interface Actionpublic Context getApplication()
Action
getApplication in interface Actionpublic Context getCookies()
Action
getCookies in interface Actionpublic Locale getLocale()
Action
getLocale in interface Actionpublic <E> E getSessionObj()
public <E> E getUserSession()
public Locale getUserLocale()
public boolean isLogged()
public void adhere()
StickyAction
adhere in interface StickyActionpublic void disjoin()
StickyAction
disjoin in interface StickyActionpublic void onRemoved()
StickyAction
onRemoved in interface StickyAction
public String execute()
throws Exception
Exceptionpublic void ajax(Object value)
value - public void stream(Object value)
public void stream(Object value,
int length)
public void redir(String url)
url - public String getContextPath()
public Input input()
public Output output()
public Context session()
public Context application()
public Context cookies()
public Locale loc()
public static Object findValue(String key,
Action action)
public Object findValue(String key)
public void setSessionObj(Object user)
public void setSessionUser(Object user)
public void setSessionGroup(Enum<?> e)
public void setSessionGroups(Enum<?>... es)
public void setSessionGroup(String group)
public void setSessionGroups(String... groups)
public Locale getSessionLocale()
public void setSessionLocale(Locale loc)
public void setSessionLocale(String locale)
public void setUserSession(Object user)
public void replaceSessionObj(Object newUser)
public void replaceUserSession(Object newUser)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||