Search in sources :

Example 61 with ActionForward

use of org.apache.struts.action.ActionForward in project sonarqube by SonarSource.

the class TestActionConfigMatcher method buildActionConfig.

private ActionConfig buildActionConfig(String path) {
    ActionMapping mapping = new ActionMapping();
    mapping.setName("name,{1}");
    mapping.setPath(path);
    mapping.setScope("request");
    mapping.setUnknown(false);
    mapping.setValidate(true);
    mapping.setPrefix("foo,{1}");
    mapping.setSuffix("bar,{1}");
    mapping.setType("foo.bar.{1}Action");
    mapping.setRoles("public,{1}");
    mapping.setParameter("param,{1}");
    mapping.setAttribute("attrib,{1}");
    mapping.setForward("fwd,{1}");
    mapping.setInclude("include,{1}");
    mapping.setInput("input,{1}");
    ForwardConfig cfg = new ActionForward();
    cfg.setName("name");
    cfg.setPath("path,{1}");
    cfg.setModule("mod{1}");
    cfg.setProperty("foo", "bar,{1}");
    mapping.addForwardConfig(cfg);
    cfg = new ActionForward();
    cfg.setName("name2");
    cfg.setPath("path2");
    cfg.setModule("mod{1}");
    mapping.addForwardConfig(cfg);
    ExceptionConfig excfg = new ExceptionConfig();
    excfg.setKey("foo");
    excfg.setType("foo.Bar");
    excfg.setPath("path");
    mapping.addExceptionConfig(excfg);
    excfg = new ExceptionConfig();
    excfg.setKey("foo2");
    excfg.setType("foo.Bar2");
    excfg.setPath("path2");
    mapping.addExceptionConfig(excfg);
    mapping.setProperty("testprop", "testval");
    mapping.setProperty("testprop2", "test{1}");
    mapping.freeze();
    return mapping;
}
Also used : ActionMapping(org.apache.struts.action.ActionMapping) ActionForward(org.apache.struts.action.ActionForward)

Example 62 with ActionForward

use of org.apache.struts.action.ActionForward in project head by mifos.

the class BaseAction method execute.

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    configureDaoBeans();
    configureServiceFacadeBeans();
    configureLegacyDaoBeans();
    checkLocaleContext(request);
    if (MifosBatchJob.isBatchJobRunningThatRequiresExclusiveAccess()) {
        return logout(mapping, request);
    }
    ShutdownManager shutdownManager = (ShutdownManager) ServletUtils.getGlobal(request, ShutdownManager.class.getName());
    if (shutdownManager.isShutdownDone()) {
        return shutdown(mapping, request);
    }
    if (shutdownManager.isInShutdownCountdownNotificationThreshold()) {
        request.setAttribute("shutdownIsImminent", true);
    }
    if (null != request.getSession().getAttribute("currentPageUrl")) {
        SessionUtils.setAttribute("backPageUrl", UrlHelper.constructCurrentPageUrl(request), request);
    }
    boolean flag = AccountingRules.getSimpleAccountingStatus();
    request.getSession().setAttribute("accountingActivationStatus", flag);
    TransactionDemarcate annotation = getTransaction(form, request);
    preExecute(form, request, annotation);
    ActionForward forward = super.execute(mapping, form, request, response);
    try {
        request.getSession().setAttribute("previousPageUrl", UrlHelper.constructCurrentPageUrl(request));
    } catch (Exception e) {
        request.setAttribute("previousPageUrl", "");
    }
    // TODO: passing 'true' to postExecute guarantees that the session will
    // be closed still working through resolving issues related to enforcing
    // this postExecute(request, annotation, true);
    postExecute(request, annotation, isCloseSessionAnnotationPresent(form, request));
    return forward;
}
Also used : ShutdownManager(org.mifos.application.admin.system.ShutdownManager) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate) ActionForward(org.apache.struts.action.ActionForward) InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) SystemException(org.mifos.framework.exceptions.SystemException) ValueObjectConversionException(org.mifos.framework.exceptions.ValueObjectConversionException) HibernateException(org.hibernate.HibernateException) ServiceException(org.mifos.framework.exceptions.ServiceException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException)

Aggregations

ActionForward (org.apache.struts.action.ActionForward)62 AbstractContest (cn.edu.zju.acm.onlinejudge.bean.AbstractContest)16 ActionMessages (org.apache.struts.action.ActionMessages)14 Problem (cn.edu.zju.acm.onlinejudge.bean.Problem)11 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)11 UserProfile (cn.edu.zju.acm.onlinejudge.bean.UserProfile)9 ActionMessage (org.apache.struts.action.ActionMessage)9 UserContext (org.mifos.security.util.UserContext)7 Date (java.util.Date)6 AuthorizationPersistence (cn.edu.zju.acm.onlinejudge.persistence.AuthorizationPersistence)5 CloseSession (org.mifos.framework.util.helpers.CloseSession)5 Submission (cn.edu.zju.acm.onlinejudge.bean.Submission)4 RoleSecurity (cn.edu.zju.acm.onlinejudge.security.RoleSecurity)4 Language (cn.edu.zju.acm.onlinejudge.bean.enumeration.Language)3 ContestPersistence (cn.edu.zju.acm.onlinejudge.persistence.ContestPersistence)3 ProblemPersistence (cn.edu.zju.acm.onlinejudge.persistence.ProblemPersistence)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ActionMapping (org.apache.struts.action.ActionMapping)3 Test (org.junit.Test)3