org.mentawai.core
Class SingleInstanceBaseAction

java.lang.Object
  extended by org.mentawai.core.BaseAction
      extended by org.mentawai.core.SingleInstanceBaseAction
All Implemented Interfaces:
Action, StickyAction
Direct Known Subclasses:
SuccessAction

public abstract class SingleInstanceBaseAction
extends BaseAction

This is the base class for single instance actions, in other words, those actions that will be instantiated only once and shared among all requests. Sometimes, when you looking for every performance drop, you may not want to create a new action instance for every request. This class keeps the action data in thread locals, so that each thread has its own input, output, session, application and locale. The actions extending this class must be configurated with a SingleInstanceActionConfig. It is your responsibility to make your action thread-safe, otherwise you should stick with the BaseAction class.

Author:
Sergio Oliveira

Field Summary
 
Fields inherited from class org.mentawai.core.BaseAction
cookies, msgContext
 
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, NOT_FOUND, NULL, REMOVED, SHOW, STREAM, SUCCESS, TEST, UPDATED, XML
 
Constructor Summary
SingleInstanceBaseAction()
          Creates a SingleInstanceBaseAction.
 
Method Summary
 Context getApplication()
          Gets this action application context.
 Input getInput()
          Gets the action input.
 Locale getLocale()
          Gets the use locale for this action.
 Output getOutput()
          Gets the action output.
 Context getSession()
          Gets this action session context.
 void removeAll()
           
 void setApplication(Context application)
          Sets the application 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.
 void setOutput(Output output)
          Sets the output for this action.
 void setSession(Context session)
          Sets the session context for this action.
 
Methods inherited from class org.mentawai.core.BaseAction
addError, addError, addError, addError, addError, addError, addError, addError, addError, addError, addError, addError, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, addMessage, adhere, ajax, application, commit, commit, cookies, disjoin, execute, findValue, findValue, getContextPath, getCookies, getError, getLocalizedText, getLocalizedText, getMessageTokens, getMessageTokens, getPrettyURL, getSessionLocale, getSessionObj, getUserLocale, getUserSession, hasError, init, init, input, isAjaxRequest, isAjaxRequest, isEmpty, isGet, isGet, isLogged, isPost, isPost, isPrettyURL, loc, onRemoved, output, redir, replaceSessionObj, replaceUserSession, rollback, rollback, session, setCookies, setMessageContext, setSessionGroup, setSessionGroup, setSessionGroups, setSessionGroups, setSessionLocale, setSessionLocale, setSessionObj, setSessionUser, setUserSession, stream, stream, stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleInstanceBaseAction

public SingleInstanceBaseAction()
Creates a SingleInstanceBaseAction.

Method Detail

removeAll

public void removeAll()

setInput

public void setInput(Input input)
Description copied from interface: Action
Sets the input for this action.

Specified by:
setInput in interface Action
Overrides:
setInput in class BaseAction
Parameters:
input - the input to be set

setOutput

public void setOutput(Output output)
Description copied from interface: Action
Sets the output for this action.

Specified by:
setOutput in interface Action
Overrides:
setOutput in class BaseAction
Parameters:
output - the output to be set

setSession

public void setSession(Context session)
Description copied from interface: Action
Sets the session context for this action.

Specified by:
setSession in interface Action
Overrides:
setSession in class BaseAction
Parameters:
session - The context to be set

setApplication

public void setApplication(Context application)
Description copied from interface: Action
Sets the application context for this action.

Specified by:
setApplication in interface Action
Overrides:
setApplication in class BaseAction
Parameters:
application - The context to be set

setLocale

public void setLocale(Locale loc)
Description copied from interface: Action
Sets the user locale for this action.

Specified by:
setLocale in interface Action
Overrides:
setLocale in class BaseAction
Parameters:
loc - The user locale to set.

getInput

public Input getInput()
Description copied from interface: Action
Gets the action input.

Specified by:
getInput in interface Action
Overrides:
getInput in class BaseAction
Returns:
The action input

getOutput

public Output getOutput()
Description copied from interface: Action
Gets the action output.

Specified by:
getOutput in interface Action
Overrides:
getOutput in class BaseAction
Returns:
The action output

getSession

public Context getSession()
Description copied from interface: Action
Gets this action session context.

Specified by:
getSession in interface Action
Overrides:
getSession in class BaseAction
Returns:
The session context

getApplication

public Context getApplication()
Description copied from interface: Action
Gets this action application context.

Specified by:
getApplication in interface Action
Overrides:
getApplication in class BaseAction
Returns:
The application context

getLocale

public Locale getLocale()
Description copied from interface: Action
Gets the use locale for this action.

Specified by:
getLocale in interface Action
Overrides:
getLocale in class BaseAction
Returns:
The user locale


Copyright © 2013. All Rights Reserved.