private boolean handleHelperDone() { Logger.log.info("Done handling helper in view: " + viewParameters.viewID); // Removing hack tsh.clearTokenState(IN_HELPER_INDICATOR); ELReference elref = (ELReference) tsh.getTokenState( TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.POST_HELPER_BINDING); ParameterList paramlist = (ParameterList) tsh.getTokenState( TOKEN_STATE_PREFIX + viewParameters.viewID + POST_HELPER_BINDING_PARAMLIST); statePreservationManager.scopeRestore(); if (paramlist != null) { for (int i = 0; i < paramlist.size(); i++) { UIParameter param = (UIParameter) paramlist.get(i); if (param instanceof UIELBinding) { bma.setBeanValue( ((UIELBinding) param).valuebinding.value, beanLocator, ((UIELBinding) param).rvalue, null, false); } } } String methodBinding = elref == null ? null : elref.value; Object beanReturn = null; if (methodBinding != null) { ShellInfo shells = bma.fetchShells(methodBinding, beanLocator, true); beanReturn = bma.invokeBeanMethod(shells, null); } ViewParameters originParams = (ViewParameters) tsh.getTokenState( TOKEN_STATE_PREFIX + viewParameters.viewID + POST_HELPER_ARI2_VIEWPARAMS); ARIResult ariresult = ari.interpretActionResult(viewParameters, beanReturn); ariprocessor.interceptActionResult(ariresult, originParams, ariresult); String urlToRedirectTo = ViewParamUtil.getAnyFullURL(ariresult.resultingView, vsh); try { response.sendRedirect(urlToRedirectTo); } catch (IOException e) { throw UniversalRuntimeException.accumulate(e, "Error redirecting to url: " + urlToRedirectTo); } return true; }
private boolean handleHelperHelper(final String pathBeyondViewID) { Logger.log.info( "Handling helper in view: " + viewParameters.viewID + " pathBeyondViewID: " + pathBeyondViewID); String helperId = (String) tsh.getTokenState( TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.HELPER_ID); if (pathBeyondViewID.endsWith(".helper")) { int i = pathBeyondViewID.lastIndexOf('/'); if (i >= 0) { String helperName = pathBeyondViewID.substring(i + 1); String toolName = pathBeyondViewID.substring(0, i); i = helperName.lastIndexOf('.'); helperName = helperName.substring(0, i); Logger.log.debug("new helper name" + helperName); Logger.log.debug("tool name" + toolName); tsh.putTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "orig-helper-id", helperId); tsh.putTokenState( TOKEN_STATE_PREFIX + viewParameters.viewID + "helper-tool-name", toolName); helperId = helperName; tsh.putTokenState( TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.HELPER_ID, helperId); } } String origToolName = (String) tsh.getTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "helper-tool-name"); if (origToolName != null && pathBeyondViewID.endsWith(origToolName)) { helperId = (String) tsh.getTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "orig-helper-id"); Logger.log.debug("returning to " + helperId); tsh.putTokenState( TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.HELPER_ID, helperId); tsh.clearTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "helper-tool-name"); tsh.clearTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "orig-helper-id"); } ActiveTool helperTool = activeToolManager.getActiveTool(helperId); String baseUrl = bup.getBaseURL(); int hostStart = baseUrl.indexOf("://") + 3; int hostEnd = baseUrl.indexOf('/', hostStart); String contextPath = baseUrl.substring(hostEnd); contextPath += viewParameters.viewID; contextPath += IN_HELPER_PATH; String helperPathInfo = pathInfo[0] + "/" + pathInfo[1]; request.removeAttribute(Tool.NATIVE_URL); // this is the forward call try { helperTool.help(request, response, contextPath, helperPathInfo); } catch (ToolException e) { throw UniversalRuntimeException.accumulate( e, "ToolException when trying to call help. HelperId: " + helperId + " contextPath: " + contextPath + " pathInfo: " + pathInfo); } return true; }