1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
public ActionForward execute(ActionMapping pMapping, ActionForm pForm,
HttpServletRequest pRequest, HttpServletResponse pResponse) {
String lsPrefixe = "Class = GenericAction, Method = execute --> ";
//Action forward
ActionForward lForward = null;
if (LOGGER.isDebugEnabled()){
LOGGER.debug(lsPrefixe + "BEGIN execute");
}
try {
//Set a default forward
lForward = pMapping.findForward(sMAPPING_ERROR);
GenericActionForm lGenericActionForm = (GenericActionForm) pForm;
String userAgent = pRequest.getHeader("User-Agent");
if ((userAgent != null) && (userAgent.indexOf("MSIE") != -1)){
lGenericActionForm.setNavigator("MSIE");
}else{
lGenericActionForm.setNavigator("OtherNavigator");
}
// Forward vers la prochaine action ou jsp
lForward = proceedAction(pMapping, pForm, pRequest, pResponse);
} catch (Exception e) {
LOGGER.error(lsPrefixe + "Error processing Action : ", e);
// Error list
ActionErrors lErrors = new ActionErrors();
// Error
ActionMessage lError;
String lMessagExpt = "Error processing Action";
String lMessagFinal = "<br>" + lMessagExpt + "<br>";
lError = new ActionMessage(ERROR_LABEL, lMessagFinal);
// Ajout de la nouvelle erreur
lErrors.add(ActionMessages.GLOBAL_MESSAGE, lError);
// Passage sur le formulaire
addErrors(pRequest, lErrors);
// On redirige vers la page d'erreur.
lForward = pMapping.findForward(sMAPPING_ERROR);
} catch (Throwable e) {
LOGGER.error(lsPrefixe + "Throwable processing Action : ", e);
} finally {
if (LOGGER.isDebugEnabled()){
LOGGER.debug(lsPrefixe + "END execute");
}
}
return lForward;
}
protected abstract ActionForward proceedAction(ActionMapping pMapping,
ActionForm pForm, HttpServletRequest pRequest,
HttpServletResponse pResponse) throws Exception; |
Partager