Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.action
Class LoginAction

java.lang.Object
  extended by com.opensymphony.xwork.ActionSupport
      extended by com.jivesoftware.base.action.LoginAction
All Implemented Interfaces:
RegistrationManagerAware, com.opensymphony.webwork.interceptor.ServletRequestAware, com.opensymphony.webwork.interceptor.ServletResponseAware, com.opensymphony.webwork.interceptor.SessionAware, com.opensymphony.xwork.Action, com.opensymphony.xwork.LocaleProvider, com.opensymphony.xwork.TextProvider, com.opensymphony.xwork.Validateable, com.opensymphony.xwork.ValidationAware, com.uwyn.rife.continuations.ContinuableObject, java.io.Serializable, java.lang.Cloneable

public class LoginAction
extends com.opensymphony.xwork.ActionSupport
implements com.opensymphony.webwork.interceptor.SessionAware, com.opensymphony.webwork.interceptor.ServletRequestAware, com.opensymphony.webwork.interceptor.ServletResponseAware, com.opensymphony.xwork.Validateable, RegistrationManagerAware

This class is an Action which encapsulates all the logic of user log-in. This action expects a username, password and optionally a flag for auto-login.

Unlike other Actions that have declared views, the views for this action largely depend on the context it's being executed from. For that reason, this Action expects to be told where to redirect to after 1) a successful login and 2) when the user cancels the login. These parameters can be set as properties of this action (parameters viewed with respect to the web), in the request as an attribute or in the user's session.

See Also:
Serialized Form

Field Summary
protected  boolean autoLogin
           
protected  boolean cancel
           
protected  java.lang.String cancelURL
           
protected  boolean createAccount
           
static java.lang.String LOGIN_CANCEL_URL
          The URL where a user redirects after a cancel is issued.
static java.lang.String LOGIN_SUCCESS_URL
          The URL where a user redirects after a successful login.
protected  java.lang.String password
           
protected  java.lang.String successURL
           
protected  java.lang.String username
           
 
Fields inherited from class com.opensymphony.xwork.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
LoginAction()
           
 
Method Summary
 java.lang.String doCancel()
          Deprecated.  
 java.lang.String doDefault()
           
 java.lang.String doWithRedirect()
          Webwork command that sets the success and cancel urls to be the referer and then calls the default command.
 java.lang.String execute()
          Attempt to log the user in.
 java.lang.String getCancelURL()
          Returns the url that the login will redirect to upon a cancel request.
 java.lang.String getPassword()
          Returns the password used to do a login.
 java.lang.String getSuccessURL()
          Returns the url that the login will redirect to upon a successful login.
 java.lang.String getUsername()
          Returns the username used to do a login.
protected  java.lang.String handleCancel()
           
protected  java.lang.String handleCreateAccount()
           
protected  java.lang.String handleLogin()
           
 boolean isAutoLogin()
          Returns true if the user wants to enable auto-login, false otherwise.
 boolean isCancel()
           
 void setAutoLogin(boolean autoLogin)
          Sets whether or not the user wants to automatically login.
 void setDoCancel(java.lang.String cancel)
           
 void setNewaccount(java.lang.String s)
           
 void setPassword(java.lang.String password)
          Sets the password used to do a login if the password is not null and not a zero-length String.
 void setRegistrationManager(RegistrationManager registrationManager)
           
 void setServletRequest(javax.servlet.http.HttpServletRequest request)
           
 void setServletResponse(javax.servlet.http.HttpServletResponse response)
           
 void setSession(java.util.Map session)
           
 void setSuccessURL(java.lang.String successURL)
          Sets the url that the login will redirect to upon a successful login.
 void setUsername(java.lang.String username)
          Sets the username used to do a login if the username is not null and not a zero-length String.
 void validate()
           
 
Methods inherited from class com.opensymphony.xwork.ActionSupport
addActionError, addActionMessage, addFieldError, clearErrorsAndMessages, clone, doInput, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getLocale, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, pause, setActionErrors, setActionMessages, setFieldErrors
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGIN_SUCCESS_URL

public static final java.lang.String LOGIN_SUCCESS_URL
The URL where a user redirects after a successful login. This value might need to be stored in the request or session - this variable is a key for that store.

See Also:
Constant Field Values

LOGIN_CANCEL_URL

public static final java.lang.String LOGIN_CANCEL_URL
The URL where a user redirects after a cancel is issued. This value might need to be stored in the request or session - this variable is a key for that store.

See Also:
Constant Field Values

username

protected java.lang.String username

password

protected java.lang.String password

autoLogin

protected boolean autoLogin

successURL

protected java.lang.String successURL

cancelURL

protected java.lang.String cancelURL

cancel

protected boolean cancel

createAccount

protected boolean createAccount
Constructor Detail

LoginAction

public LoginAction()
Method Detail

setServletRequest

public void setServletRequest(javax.servlet.http.HttpServletRequest request)
Specified by:
setServletRequest in interface com.opensymphony.webwork.interceptor.ServletRequestAware

setServletResponse

public void setServletResponse(javax.servlet.http.HttpServletResponse response)
Specified by:
setServletResponse in interface com.opensymphony.webwork.interceptor.ServletResponseAware

setSession

public void setSession(java.util.Map session)
Specified by:
setSession in interface com.opensymphony.webwork.interceptor.SessionAware

setRegistrationManager

public void setRegistrationManager(RegistrationManager registrationManager)
Specified by:
setRegistrationManager in interface RegistrationManagerAware

getUsername

public java.lang.String getUsername()
Returns the username used to do a login.

Returns:
the username used to do a login.

setUsername

public void setUsername(java.lang.String username)
Sets the username used to do a login if the username is not null and not a zero-length String.

Parameters:
username - the username used to do a login.

getPassword

public java.lang.String getPassword()
Returns the password used to do a login.

Returns:
the password used to do a login.

setPassword

public void setPassword(java.lang.String password)
Sets the password used to do a login if the password is not null and not a zero-length String.

Parameters:
password - the password used to do a login.

isAutoLogin

public boolean isAutoLogin()
Returns true if the user wants to enable auto-login, false otherwise.

Returns:
true if the user wants to enable auto-login, false otherwise.

setAutoLogin

public void setAutoLogin(boolean autoLogin)
Sets whether or not the user wants to automatically login.

Parameters:
autoLogin - whether or not the user wants to automatically login.

getSuccessURL

public java.lang.String getSuccessURL()
Returns the url that the login will redirect to upon a successful login.

Returns:
the url that the login will redirect to upon a successful login.

setSuccessURL

public void setSuccessURL(java.lang.String successURL)
Sets the url that the login will redirect to upon a successful login.

Parameters:
successURL - the url that the login will redirect to upon a successful login.

getCancelURL

public java.lang.String getCancelURL()
Returns the url that the login will redirect to upon a cancel request.

Returns:
the url that the login will redirect to upon a cancel request.

setNewaccount

public void setNewaccount(java.lang.String s)

isCancel

public boolean isCancel()

setDoCancel

public void setDoCancel(java.lang.String cancel)

validate

public void validate()
Specified by:
validate in interface com.opensymphony.xwork.Validateable
Overrides:
validate in class com.opensymphony.xwork.ActionSupport

doDefault

public java.lang.String doDefault()
Overrides:
doDefault in class com.opensymphony.xwork.ActionSupport

doWithRedirect

public java.lang.String doWithRedirect()
Webwork command that sets the success and cancel urls to be the referer and then calls the default command.


execute

public java.lang.String execute()
                         throws java.lang.Exception
Attempt to log the user in. If successful, the user is redirected to the url as set through the successURL variable.

Specified by:
execute in interface com.opensymphony.xwork.Action
Overrides:
execute in class com.opensymphony.xwork.ActionSupport
Returns:
the {#ERROR} view if login failed or the Action.SUCCESS view if the login attempt was successful.
Throws:
java.lang.Exception

handleLogin

protected java.lang.String handleLogin()

handleCancel

protected java.lang.String handleCancel()

handleCreateAccount

protected java.lang.String handleCreateAccount()

doCancel

public java.lang.String doCancel()
Deprecated. 

Webwork command that cancel's the login attempt and returns the user to the url as set through the cancelURL variable.

Returns:
the cancel view

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.