Java Code Examples for org.apache.struts.action.ActionMapping#getPath()

The following examples show how to use org.apache.struts.action.ActionMapping#getPath() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SetupWizardAction.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets common attributes needed by setup-tab-footer.jspf.
 * @param mapping the Action mapping object
 * @param request current request object
 * @throws Exception if parsing of navigation XML fails
 */
private void setAttributes(ActionMapping mapping, HttpServletRequest request)
    throws Exception {
    String path = mapping.getPath();
    logger.debug("Current path: " + path);
    NavTree tree =
            NavCache.getTree(getServlet().getServletContext().getResource(
                    NAVIGATION_XML_PATH));
    List<NavNode> nodes = (List<NavNode>) tree.getNodes();
    int nodeIndex = getNodeIndex(path, nodes);
    int totalSteps = nodes.size();

    request.setAttribute(CURRENT_STEP_ATTRIBUTE, nodeIndex + 1);

    request.setAttribute(TOTAL_STEPS_ATTRIBUTE, totalSteps);

    request.setAttribute(PREVIOUS_STEP_ATTRIBUTE,
            nodeIndex == 0 ? null : nodes.get(nodeIndex - 1).getURLs().get(0));

    request.setAttribute(NEXT_STEP_ATTRIBUTE,
            nodeIndex == (totalSteps - 1) ? null : nodes.get(nodeIndex + 1).getURLs()
                    .get(0));

    request.setAttribute(ISS_MASTER, IssFactory.getCurrentMaster() == null);
    ContentSyncManager csm = new ContentSyncManager();
    request.setAttribute(REFRESH_NEEDED, csm.isRefreshNeeded(null));

    TaskoRun latestRun = TaskoFactory.getLatestRun("mgr-sync-refresh-bunch");
    request.setAttribute(REFRESH_RUNNING,
            latestRun != null && latestRun.getEndTime() == null);
}
 
Example 2
Source File: KualiAction.java    From rice with Educational Community License v2.0 5 votes vote down vote up
/**
 * Takes care of storing the action form in the User session and forwarding to the workflow workgroup lookup action.
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ActionForward performWorkgroupLookup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    String returnUrl = null;
    if ("/kr".equals(mapping.getModuleConfig().getPrefix())) {
        returnUrl = getApplicationBaseUrl() + mapping.getModuleConfig().getPrefix() + mapping.getPath() + ".do";
    } else {
        returnUrl = getApplicationBaseUrl() + mapping.getPath() + ".do";
    }


    String fullParameter = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE);
    String conversionFields = StringUtils.substringBetween(fullParameter, KRADConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KRADConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL);

    String deploymentBaseUrl = CoreApiServiceLocator.getKualiConfigurationService().getPropertyValueAsString(
            KRADConstants.WORKFLOW_URL_KEY);
    String workgroupLookupUrl = deploymentBaseUrl + "/Lookup.do?lookupableImplServiceName=WorkGroupLookupableImplService&methodToCall=start&docFormKey=" + GlobalVariables.getUserSession().addObjectWithGeneratedKey(form);

    if (conversionFields != null) {
        workgroupLookupUrl += "&conversionFields=" + conversionFields;
    }
    if (form instanceof KualiDocumentFormBase) {
        workgroupLookupUrl +="&docNum="+ ((KualiDocumentFormBase) form).getDocument().getDocumentNumber();
    }
    
    workgroupLookupUrl += "&returnLocation=" + returnUrl;

    return new ActionForward(workgroupLookupUrl, true);
}
 
Example 3
Source File: KewKualiAction.java    From rice with Educational Community License v2.0 5 votes vote down vote up
@Override 
protected String getReturnLocation(HttpServletRequest request, ActionMapping mapping) 
   {
   	String mappingPath = mapping.getPath();
   	String basePath = getApplicationBaseUrl();
       return basePath + KewApiConstants.WEBAPP_DIRECTORY + mappingPath + ".do";
   }
 
Example 4
Source File: ActionListFilterAction.java    From rice with Educational Community License v2.0 5 votes vote down vote up
/**
 * This overridden method ...
 *
 * @see org.kuali.rice.krad.web.struts.action.KualiAction#getReturnLocation(javax.servlet.http.HttpServletRequest, org.apache.struts.action.ActionMapping)
 */
@Override
protected String getReturnLocation(HttpServletRequest request,
                                   ActionMapping mapping)
{
    String mappingPath = mapping.getPath();
    String basePath = getApplicationBaseUrl();
    return basePath + KewApiConstants.WEBAPP_DIRECTORY + mappingPath + ".do";
}
 
Example 5
Source File: KualiAction.java    From rice with Educational Community License v2.0 4 votes vote down vote up
protected String getReturnLocation(HttpServletRequest request, ActionMapping mapping) {
    String mappingPath = mapping.getPath();
    String basePath = getApplicationBaseUrl();
    return basePath + ("/lookup".equals(mappingPath) || "/maintenance".equals(mappingPath) || "/multipleValueLookup".equals(mappingPath) ? "/kr" : "") + mappingPath + ".do";
}
 
Example 6
Source File: FacesEntryPoint.java    From fenixedu-academic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    return new ActionForward(mapping.getPath() + ".faces");
}
 
Example 7
Source File: RefactoredIndividualCandidacyProcessPublicDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected String getLinkFromPublicCandidacyHashCodeForInternalUse(ActionMapping mapping, HttpServletRequest request,
        PublicCandidacyHashCode hashCode) {
    return mapping.getPath() + ".do?method=prepareCandidacyCreation&hash=" + hashCode.getValue();
}