|
PAJES 2.3.9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.pajes.servlet.PajeServlet
org.pajes.servlet.DataAccessPajeServlet
org.pajes.servlet.AuthenticatedPajeServlet
org.pajes.db.entity.MaintenanceServlet
Servlet to manage Entity objects. Access to this servlet can be controlled by
the use of the ROLE_ATTRIBUTE, which is a ServletContext attribute
to set the name of the role that may access sub-classes of this class. If not
specified in the deployment descriptor, any role may invoke
MaintenanceServlet sub-classes.
Actions may also be audited through the use of the AUDIT_ATTRIBUTE
ServletContext attribute. If this attribute exists, it will be checked to see
if it contains the current ACTION_PARAMETERvalue. Mulitple types of
actions can be audited by concatenating the required action values. Audit
messages are written to the ServletContext log.
| Field Summary | |
static java.lang.String |
ACTION_PARAMETER
The name of the request parameter that determines what action will be taken by this servlet. |
static java.lang.String |
AUDIT_ATTRIBUTE
Context attribute to set the ACTION_PARAMETERvalues that will
be audited. |
static java.lang.String |
CANCEL_ACTION_VALUE
The value of the ACTION_PARAMETERthat indicates that the
request is to cancel changes to an Entity and return to the list. |
static java.lang.String |
CREATE_ACTION_VALUE
The value of the ACTION_PARAMETERthat indicates that the
request is to create a new Entity. |
static java.lang.String |
DELETE_ACTION_VALUE
The value of the ACTION_PARAMETERthat indicates that the
request is to delete an Entity. |
static java.lang.String |
MODIFY_ACTION_VALUE
The value of the ACTION_PARAMETERthat indicates that the
request is to edit an existing Entity. |
static java.lang.String |
ROLE_ATTRIBUTE
Context attribute to set the name of the role that may access sub-classes of this class. |
static java.lang.String |
UPDATE_ACTION_VALUE
The value of the ACTION_PARAMETERthat indicates that the
request is to update an existing Entity. |
static java.lang.String |
VIEW_ACTION_VALUE
The value of the ACTION_PARAMETERthat indicates that the
request is to view an existing Entity. |
| Constructor Summary | |
protected |
MaintenanceServlet(Manager manager)
Creates a servlet that will manage Entities. |
| Method Summary | |
protected void |
audit(javax.servlet.http.HttpServletRequest request,
java.lang.String action,
Entity entity)
Handles auditing of requests. |
protected void |
beforeSave(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Entity entity)
Called by doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), before saving the Entity. |
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles the request to display a screen. |
protected void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles an action request. |
protected Paje |
getCancelDocument(javax.servlet.http.HttpServletRequest request)
Returns the document that will be sent back to the browser when the user selected the cancelaction. |
protected Paje |
getEditor(javax.servlet.http.HttpServletRequest request,
boolean isNew)
Returns a Paje to display and/or edit an Entity object. |
protected Entity |
getEntityFromSession(javax.servlet.http.HttpServletRequest request)
Retrieves the Entity from the HttpSession that matches the key contained in the request parameters. |
protected static Entity |
getEntityFromSession(Manager manager,
javax.servlet.http.HttpServletRequest request)
Retrieves the Entity from the HttpSession that matches the key contained in the request parameters. |
protected Paje |
getLister(javax.servlet.http.HttpServletRequest request)
Returns a Paje to display a list of Entity objects. |
protected Manager |
getManager()
Returns the Managerof the Entityobjects administered by
this servlet. |
protected Paje |
getNoRowsAffectedDocument(javax.servlet.http.HttpServletRequest request)
Returns the document that will be sent back to the browser when no rows are affected when it is attempted to save the Entity to the database. |
protected Paje |
getSQLExceptionDocument(javax.servlet.http.HttpServletRequest request,
java.sql.SQLException exception)
Returns the document that will be sent back to the browser when a SQLException is caught when retrieving or saving an Entity. |
protected Paje |
getSuccessDocument(javax.servlet.http.HttpServletRequest request)
Returns the document that will be sent back to the browser when a no exceptions were caught when retrieving or saving an Entity. |
protected Paje |
getViewer(javax.servlet.http.HttpServletRequest request)
Returns a Paje to display an Entity object. |
protected void |
handleCancel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Deprecated. 2.3.3: Use handleCancel(HttpServletRequest request,
HttpServletResponse response, Entity entity) instead. |
protected void |
handleCancel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Entity entity)
Handles the situation where the user selects the cancel action. |
protected void |
handleNoRowsAffected(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Entity entity)
Handles the situation where no rows are affected when it is attempted to save the Entity to the database. |
protected void |
handleSQLException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.sql.SQLException exception,
Entity entity)
Handles the situation where a SQLException is caught when retrieving or saving an Entity. |
protected void |
handleSuccess(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
int rows,
Entity entity)
Handles the situation where a delete, update or insert succeeded. |
void |
init(javax.servlet.ServletConfig config)
Initialises this maintenance servlet. |
protected boolean |
isCancelAction(java.lang.String action)
Determines if this is a request to cancel making changes to an entity. |
protected boolean |
isDeleteAction(java.lang.String action)
Determines if this is a request to delete an entity. |
protected boolean |
isPermitted(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Validates access to this servlet. |
protected boolean |
isUpdateAction(java.lang.String action)
Determines if this is a request to save a modified or new entity. |
protected void |
onCreate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Paje doc)
Called by doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), when a CREATE_ACTION_VALUErequest is
received, after creating the document to be returned to the browser. |
protected void |
onList(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Paje lister)
Called by doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), when neither the CREATE_ACTION_VALUE,
VIEW_ACTION_VALUEor MODIFY_ACTION_VALUEactions are
specifed on the request, after creating the lister document to be
returned to the browser. |
protected void |
onModify(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Paje doc)
Called by doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), when a MODIFY_ACTION_VALUErequest is
received, after creating the document to be returned to the browser. |
protected void |
onView(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Paje doc)
Called by doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), when a VIEW_ACTION_VALUErequest is
received, after creating the document to be returned to the browser. |
protected void |
removeEntityFromSession(javax.servlet.http.HttpServletRequest request,
Entity entity)
Removes the specified Entity from the HttpSession. |
| Methods inherited from class org.pajes.servlet.AuthenticatedPajeServlet |
doForbidden, getAccessPermission, isPermitted, service |
| Methods inherited from class org.pajes.servlet.DataAccessPajeServlet |
getDBConnection, getDBConnection, getDBConnectionPoolManager |
| Methods inherited from class org.pajes.servlet.PajeServlet |
createPaje, createPaje, createPaje, getAbsoluteHREF, getBaseHREF, getMaxFileUploadSize, getPajeFactory, getResource, getUploadedFile, getUploadedFileNames, handleException, log, log, setInputFieldsFromRequestAttributes, setInputFieldsFromRequestParameters, setMaxFileUploadSize, setPajeFactory |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service |
| Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String ACTION_PARAMETER
GET request, or a value other than one of ,
MODIFY_ACTION_VALUEor , indicates
that a list is required.
The value of this constant is "_a_".
public static final java.lang.String AUDIT_ATTRIBUTE
ACTION_PARAMETERvalues that will
be audited.
public static final java.lang.String CANCEL_ACTION_VALUE
ACTION_PARAMETERthat indicates that the
request is to cancel changes to an Entity and return to the list.
The value of this constant is "x".
public static final java.lang.String CREATE_ACTION_VALUE
ACTION_PARAMETERthat indicates that the
request is to create a new Entity.
The value of this constant is "n".
public static final java.lang.String DELETE_ACTION_VALUE
ACTION_PARAMETERthat indicates that the
request is to delete an Entity.
The value of this constant is "d".
public static final java.lang.String MODIFY_ACTION_VALUE
ACTION_PARAMETERthat indicates that the
request is to edit an existing Entity.
The value of this constant is "e".
public static final java.lang.String ROLE_ATTRIBUTE
public static final java.lang.String UPDATE_ACTION_VALUE
ACTION_PARAMETERthat indicates that the
request is to update an existing Entity.
The value of this constant is "u".
public static final java.lang.String VIEW_ACTION_VALUE
ACTION_PARAMETERthat indicates that the
request is to view an existing Entity.
The value of this constant is "v".
| Constructor Detail |
protected MaintenanceServlet(Manager manager)
manager - the Manager of the Entity objects to be administered.| Method Detail |
public final void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
Sub-classes should over-ride the init() method to perform
any specific initialisation.
init in interface javax.servlet.Servletinit in class PajeServletconfig - the ServletConfig object.
javax.servlet.ServletException - if a fatal exception occurs.
protected static Entity getEntityFromSession(Manager manager,
javax.servlet.http.HttpServletRequest request)
manager - the entity manager.request - the servlet request.
protected boolean isCancelAction(java.lang.String action)
action - the value of the ACTION_PARAMETERfor the current
request.
protected Paje getCancelDocument(javax.servlet.http.HttpServletRequest request)
throws java.io.IOException
cancelaction.
The default implementation returns the user to the lister.
request - the request object.
java.io.IOException - if an IO error occurs.protected boolean isDeleteAction(java.lang.String action)
doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)method.
action - the value of the ACTION_PARAMETERfor the current
request.
protected Paje getEditor(javax.servlet.http.HttpServletRequest request,
boolean isNew)
throws EntityException,
java.io.IOException
Paje to display and/or edit an Entity object.
The default implementation returns the default editor.
request - the request object.isNew - true if the edit form is to be returned empty so that a new
Entity may be defined, or false if an Entity is to be
retrieved based on the requestparameters, and
then used to populate the form input fields.
EntityException - if an error occurs instantiating the Editor.
java.io.IOException - if an error occurs creating the Paje.DefaultEditorprotected Entity getEntityFromSession(javax.servlet.http.HttpServletRequest request)
request - the servlet request.
protected Paje getLister(javax.servlet.http.HttpServletRequest request)
throws EntityException,
java.io.IOException
Paje to display a list of Entity objects. The
default implementation returns the default lister.
request - the request object.
EntityException - if an error occurs instantiating the Lister.
java.io.IOException - if an error occurs creating the Paje.DefaultListerprotected Manager getManager()
Managerof the Entityobjects administered by
this servlet.
protected Paje getNoRowsAffectedDocument(javax.servlet.http.HttpServletRequest request)
throws java.io.IOException
request - the request object.
java.io.IOException - if an IO error occurs.
protected boolean isPermitted(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
request - the request object.response - the response object.
javax.servlet.ServletException - if a fatal exception occurs.
java.io.IOException - if an IO error occurs.
protected Paje getSQLExceptionDocument(javax.servlet.http.HttpServletRequest request,
java.sql.SQLException exception)
throws java.io.IOException
request - the request object.exception - the SQLException object.
java.io.IOException - if an IO error occurs.
protected Paje getSuccessDocument(javax.servlet.http.HttpServletRequest request)
throws java.io.IOException
The default implementation calls getLister(javax.servlet.http.HttpServletRequest).
request - the request object.
java.io.IOException - if an IO error occurs.protected boolean isUpdateAction(java.lang.String action)
doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)method.
action - the value of the ACTION_PARAMETERfor the current
request.
protected Paje getViewer(javax.servlet.http.HttpServletRequest request)
throws EntityException,
java.io.IOException
Paje to display an Entity object. The default
implementation returns the default viewer.
request - the request object.
EntityException - if an error occurs instantiating the Editor.
java.io.IOException - if an error occurs creating the Paje.DefaultEditor
protected void audit(javax.servlet.http.HttpServletRequest request,
java.lang.String action,
Entity entity)
request - the request objects.action - the ACTION_PARAMETERvalue.entity - the Entity being retrieved created, deleted or updated.
protected void beforeSave(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Entity entity)
throws javax.servlet.ServletException,
java.io.IOException,
java.sql.SQLException
doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), before saving the Entity. The default
implementation does nothing.
request - the request object.response - the response object.entity - the Entity about to be saved.
javax.servlet.ServletException - if a fatal exception occurs.
java.io.IOException - if an IO error occurs.
java.sql.SQLException - if an exception occurs when accessing the database.
protected void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
If the neither the CREATE_ACTION_VALUE,VIEW_ACTION_VALUE or MODIFY_ACTION_VALUEvalues are specified
for the ACTION_PARAMETERrequest parameter}, the
listerwill be displayed.
doGet in class PajeServletrequest - the request object.response - the response object.
javax.servlet.ServletException - if a fatal exception occurs.
java.io.IOException - if an IO error occurs.
protected void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
After handling the request, the user will be returned a document based on the outcome of the action they selected.
doPost in class PajeServletrequest - the request object.response - the response object.
javax.servlet.ServletException - if a fatal exception occurs.
java.io.IOException - if an IO error occurs.handleCancel(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse),
handleNoRowsAffected(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.pajes.db.entity.Entity),
handleSQLException(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.sql.SQLException, org.pajes.db.entity.Entity),
handleSuccess(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int, org.pajes.db.entity.Entity)
protected void handleCancel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
handleCancel(HttpServletRequest request,
HttpServletResponse response, Entity entity) instead.
cancel action.
This method has been deprecated. Use handleCancel(HttpServletRequest request, HttpServletResponse response,
Entity entity) instead.
request - the request object.response - the response object.
java.io.IOException - if an IO error occurs.
javax.servlet.ServletException - if a fatal exception occurs.
protected void handleCancel(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Entity entity)
throws java.io.IOException,
javax.servlet.ServletException
cancel action.
The default implementation returns the document from getCancelDocument(javax.servlet.http.HttpServletRequest) to the browser.
request - the request object.response - the response object.entity - the entity removed from the session.
java.io.IOException - if an IO error occurs.
javax.servlet.ServletException - if a fatal exception occurs.getCancelDocument(javax.servlet.http.HttpServletRequest)
protected void handleNoRowsAffected(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Entity entity)
throws java.io.IOException,
javax.servlet.ServletException
The default implementation returns the document from getNoRowsAffectedDocument(javax.servlet.http.HttpServletRequest) to the browser.
request - the request object.response - the response object.entity - Description of Parameter
java.io.IOException - if an IO error occurs.
javax.servlet.ServletException - if a fatal exception occurs.getNoRowsAffectedDocument(javax.servlet.http.HttpServletRequest)
protected void handleSQLException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.sql.SQLException exception,
Entity entity)
throws java.io.IOException,
javax.servlet.ServletException
The default implementation returns the document from getSQLExceptionDocument(javax.servlet.http.HttpServletRequest, java.sql.SQLException) to the browser.
request - the request object.response - the response object.exception - the SQLException object.entity - Description of Parameter
java.io.IOException - if an IO error occurs.
javax.servlet.ServletException - if a fatal exception occurs.getSQLExceptionDocument(javax.servlet.http.HttpServletRequest, java.sql.SQLException)
protected void handleSuccess(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
int rows,
Entity entity)
throws java.io.IOException,
javax.servlet.ServletException
The default implementation checks to see if the entity was changed, and
if the number of rows affectedis zero, passes control to handleNoRowsAffected(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.pajes.db.entity.Entity). Otherwise, it returns the document from getSuccessDocument(javax.servlet.http.HttpServletRequest) to the browser.
request - the request object.response - the response object.rows - the number of rows affected by the save.entity - the entity being edited
java.io.IOException - if an IO error occurs.
javax.servlet.ServletException - if a fatal exception occurs.
protected void onCreate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Paje doc)
throws javax.servlet.ServletException,
java.io.IOException
doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), when a CREATE_ACTION_VALUErequest is
received, after creating the document to be returned to the browser. The
default implementation does nothing.
request - the request object.response - the response object.doc - the document to be returned to the browser.
javax.servlet.ServletException - if a fatal exception occurs.
java.io.IOException - if an IO error occurs.
protected void onList(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Paje lister)
throws javax.servlet.ServletException,
java.io.IOException
doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), when neither the CREATE_ACTION_VALUE,
VIEW_ACTION_VALUEor MODIFY_ACTION_VALUEactions are
specifed on the request, after creating the lister document to be
returned to the browser. The default implementation does nothing.
request - the request object.response - the response object.lister - the lister document to be returned to the browser.
javax.servlet.ServletException - if a fatal exception occurs.
java.io.IOException - if an IO error occurs.
protected void onModify(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Paje doc)
throws javax.servlet.ServletException,
java.io.IOException
doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), when a MODIFY_ACTION_VALUErequest is
received, after creating the document to be returned to the browser. The
default implementation does nothing.
request - the request object.response - the response object.doc - the document to be returned to the browser.
javax.servlet.ServletException - if a fatal exception occurs.
java.io.IOException - if an IO error occurs.
protected void onView(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Paje doc)
throws javax.servlet.ServletException,
java.io.IOException
doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), when a VIEW_ACTION_VALUErequest is
received, after creating the document to be returned to the browser. The
default implementation does nothing.
request - the request object.response - the response object.doc - the document to be returned to the browser.
javax.servlet.ServletException - if a fatal exception occurs.
java.io.IOException - if an IO error occurs.
protected void removeEntityFromSession(javax.servlet.http.HttpServletRequest request,
Entity entity)
request - the servlet request.entity - the entity to be removed.
|
PAJES 2.3.9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||