Class PHRUTS_Action

Description

A PHRUTS_Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request.

The controller (PHRUTS_ActionService) will select an appropriate PHRUTS_Action for each request, create an instance (if necessary), and call the execute method.

When a PHRUTS_Action instance is first created, the controller service will call setService with a non-null argument to identify the controller service instance to which this PHRUTS_Action is attached. When the controller service is to be shut down (or restarted), the setService method will be called with a null argument, which can be used to clean up any allocated resources in use by this PHRUTS_Action.

  • author: John WILDENAUER <jwilde@users.sourceforge.net> (PHP4 port of Struts)
  • author: Olivier HENRY <oliv.henry@gmail.com> (PHP5 port of Struts)
  • version: $Id: PHRUTS_Action.php,v 1.3 2008/05/28 06:33:18 ohenry Exp $
  • copyright: Copyright PHruts 2008
  • todo: Manage setService() calls with or without null argument.

Located in /action/PHRUTS_Action.php (line 44)


	
			
Variable Summary
Method Summary
PHRUTS_Action __construct ()
PHRUTS_ForwardConfig execute ( $mapping, PHRUTS_ActionForm $form,  $request,  $response)
object getDataSource ( $request, string $key)
PHRUTS_Locale getLocale ( $request)
PHRUTS_MessageResources getResources ( $request, [string $key = ''])
boolean isCancelled ( $request)
void saveErrors ( $request, PHRUTS_ActionErrors $errors)
void setLocale ( $request, PHRUTS_Locale $locale)
void setService (PHRUTS_ActionService $service)
void __wakeup ()
Variables
static PHRUTS_Locale $defaultLocale = null (line 50)

The system default PHRUTS_Locale.

  • access: protected
PHRUTS_ActionService $service = null (line 57)

The controller service to which we are attached.

  • access: protected
Methods
Constructor __construct (line 59)
  • access: public
PHRUTS_Action __construct ()
execute (line 110)

Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it), with provision for handling exceptions thrown by the business logic.

Return an PHRUTS_ActionForward instance describing where and how control should be forwarded, or null if the response has already been completed.

  • throws: Exception - if the application business logic throws an exception
  • access: public
PHRUTS_ForwardConfig execute ( $mapping, PHRUTS_ActionForm $form,  $request,  $response)
getDataSource (line 126)

Return the specified data source for the current module.

  • throws: Exception
  • access: protected
object getDataSource ( $request, string $key)
  • PHRUTS_HttpServiceRequest $request: The service request we are processing
  • string $key: The key specified in the <data-source> element for the requested data source
getLocale (line 140)

Return the user's currently selected Locale.

  • access: protected
PHRUTS_Locale getLocale ( $request)
getResources (line 161)

Return the specified or default (key = "") message resources for the current module.

  • todo: Implements the code for returning message resources for the default module ($request = null).
  • access: protected
PHRUTS_MessageResources getResources ( $request, [string $key = ''])
  • PHRUTS_HttpServiceRequest $request: The service request we are processing
  • string $key: The key specified in the <message-resources> element for the requested bundle
getService (line 76)

Return the controller service instance to which we are attached.

  • access: public
PHRUTS_ActionService getService ()
isCancelled (line 188)

Returns true if the current form's cancel button was pressed.

This method will check if the PHRUTS_Globals::CANCEL_KEY request attribute has been set, which normally occurs if the cancel button was pressed by the user in the current request. If true, validation performed by a PHRUTS_ActionForm validate method will have been skipped by the controller service.

  • access: protected
boolean isCancelled ( $request)
saveErrors (line 203)

Save the specified error messages keys into the appropriate request attribute, if any messages are required.

Otherwise, ensure that the request attribute is not created.

  • todo: Check if the second parameter is a PHRUTS_ActionErrors object.
  • access: protected
void saveErrors ( $request, PHRUTS_ActionErrors $errors)
setLocale (line 223)

Set the user's currently selected PHRUTS_Locale.

  • todo: Check if the second parameter is a PHRUTS_Locale object.
  • access: protected
void setLocale ( $request, PHRUTS_Locale $locale)
setService (line 87)

Set the controller service instance to which we are attached (if service is non-null), or release any allocated resources (if service is null).

  • todo: Check if the parameter is a PHRUTS_ActionService object.
  • access: public
void setService (PHRUTS_ActionService $service)
__wakeup (line 65)
  • access: public
void __wakeup ()

Documentation generated on Sat, 31 May 2008 15:45:46 +0200 by phpDocumentor 1.4.1