|
||||||||||
| 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 java.util.Locale |
loc
|
protected Output |
output
|
protected Context |
session
|
| Fields inherited from interface org.mentawai.core.Action |
|---|
ALREADY, BLOCKED, CREATED, ERROR, INDEX, JSP, LIST, MAIN, NULL, REMOVED, SHOW, SUCCESS, TEST, UPDATED |
| 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(java.lang.String error_id)
Adds an error to the action with the given number. |
void |
addError(java.lang.String field,
int error_id)
Adds an error to the action with the given number for the given field. |
void |
addError(java.lang.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(java.lang.String field,
Message error)
Adds an error to the action for the given field. |
void |
addError(java.lang.String error_id,
MessageContext msgContext)
Adds an error to the action with the given number and context. |
void |
addError(java.lang.String field,
java.lang.String error_id)
Adds an error to the action with the given number for the given field. |
void |
addError(java.lang.String field,
java.lang.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,
MessageContext msgContext)
Adds a message to the action with the given number and context. |
void |
addMessage(Message msg)
Adds an message to the action. |
void |
addMessage(java.lang.String msg_id)
Adds a message to the action with the given number. |
void |
addMessage(java.lang.String msg_id,
MessageContext msgContext)
Adds a message to the action with the given number and context. |
void |
adhere()
Adhere to the session, so the instance of this action will persist until disjoin is called. |
void |
ajax(java.lang.Object value)
Shortcut for output.setValue(AjaxConsequence.KEY, value) |
Context |
application()
|
Context |
cookies()
|
void |
disjoin()
Remove this action from session and discard its instance losing all state (instance variables) associated with it. |
java.lang.String |
execute()
|
java.lang.Object |
findValue(java.lang.String key)
|
static java.lang.Object |
findValue(java.lang.String key,
Action action)
|
Context |
getApplication()
Gets this action application context. |
java.lang.String |
getContextPath()
|
Context |
getCookies()
Gets the cookie context for this action. |
Input |
getInput()
Gets the action input. |
java.util.Locale |
getLocale()
Gets the use locale for this action. |
static java.util.Map<java.lang.String,java.lang.String> |
getMessageTokens(Action action,
java.lang.String field)
|
protected java.util.Map<java.lang.String,java.lang.String> |
getMessageTokens(java.lang.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. |
java.util.Locale |
getUserLocale()
|
java.lang.Object |
getUserSession()
|
Input |
input()
|
boolean |
isEmpty(java.lang.String s)
|
boolean |
isLogged()
|
boolean |
isPost()
|
static boolean |
isPost(Action action)
|
java.util.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 |
replaceUserSession(java.lang.Object newUser)
|
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(java.util.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 |
setUserSession(java.lang.Object user)
|
void |
stream(java.lang.Object value)
|
void |
stream(java.lang.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 Input input
protected Output output
protected Context session
protected Context application
protected Context cookies
protected java.util.Locale loc
| Constructor Detail |
|---|
public BaseAction()
| Method Detail |
|---|
public boolean isEmpty(java.lang.String s)
public boolean isPost()
public static boolean isPost(Action action)
public static void setMessageContext(MessageContext msgContext)
msgContext - The message context to use for all actions.
public static java.util.Map<java.lang.String,java.lang.String> getMessageTokens(Action action,
java.lang.String field)
protected java.util.Map<java.lang.String,java.lang.String> getMessageTokens(java.lang.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(java.lang.String msg_id)
msg_id - The id of the message to show.public void addMessage(int msg_id)
msg_id - The id of the message to show.public void addError(java.lang.String error_id)
error_id - The id of the error to show.public void addError(int error_id)
error_id - The id of the error to show.
public void addError(java.lang.String field,
java.lang.String error_id)
field - The name of the field containing this error message.error_id - The id of the error to show.
public void addError(java.lang.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(java.lang.String 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)
msg_id - The id of the message to show.msgContext - The MessageContext where the message is.
public void addError(java.lang.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(java.lang.String field,
java.lang.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(java.lang.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 addError(Message error)
error - The error object.
public void addError(java.lang.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(java.util.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 java.util.Locale getLocale()
Action
getLocale in interface Actionpublic java.lang.Object getUserSession()
public java.util.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 java.lang.String execute()
throws java.lang.Exception
java.lang.Exceptionpublic void ajax(java.lang.Object value)
value - public void stream(java.lang.Object value)
public void stream(java.lang.Object value,
int length)
public java.lang.String getContextPath()
public Input input()
public Output output()
public Context session()
public Context application()
public Context cookies()
public java.util.Locale loc()
public static java.lang.Object findValue(java.lang.String key,
Action action)
public java.lang.Object findValue(java.lang.String key)
public void setUserSession(java.lang.Object user)
public void replaceUserSession(java.lang.Object newUser)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||