/** * Gets a single string from the request parameters * * @param key The key * @return The parameter value */ private String getParameter(String key) { String[] arr = (String[]) ActionContext.getContext().getParameters().get(key); if (arr != null && arr.length > 0) { return arr[0]; } return null; }
/** * Gets the Token value from the params in the ServletActionContext using the given name * * @param tokenName the name of the parameter which holds the token value * @return the token String or null, if the token could not be found */ public static String getToken(String tokenName) { Map params = ActionContext.getContext().getParameters(); String[] tokens = (String[]) params.get(tokenName); String token; if ((tokens == null) || (tokens.length < 1)) { LOG.warn("Could not find token mapped to token name " + tokenName); return null; } token = tokens[0]; return token; }
/** * Gets the token name from the Parameters in the ServletActionContext * * @return the token name found in the params, or null if it could not be found */ public static String getTokenName() { Map params = ActionContext.getContext().getParameters(); if (!params.containsKey(TOKEN_NAME_FIELD)) { LOG.warn("Could not find token name in params."); return null; } String[] tokenNames = (String[]) params.get(TOKEN_NAME_FIELD); String tokenName; if ((tokenNames == null) || (tokenNames.length < 1)) { LOG.warn("Got a null or empty token name."); return null; } tokenName = tokenNames[0]; return tokenName; }
bulkAction.getTaskConfigurationMap(ActionContext.getContext().getParameters()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Updating task configuration with:");
public SavedActionInvocation( ActionInvocation invocation ) { namespace = invocation.getProxy().getNamespace(); actionName = invocation.getProxy().getActionName(); methodName = invocation.getProxy().getMethod(); parameterMap = new HashMap(); parameterMap.putAll( invocation.getInvocationContext().getParameters() ); }
ActionContext ctx = ActionContext.getContext(); writer.startNode(DEBUG_PARAM); serializeIt(ctx.getParameters(), "parameters", writer, new ArrayList()); writer.startNode("context");
if (ActionContext.getContext().getParameters().get(sessionReset) != null) { return;
final ActionContext ctx = ActionContext.getContext(); String type = getParameter(DEBUG_PARAM); ctx.getParameters().remove(DEBUG_PARAM); if (XML_MODE.equals(type)) { inv.addPreResultListener(
private Map createExtraContext() { Map parentParams = null; if (!ignoreContextParams) { parentParams = new ActionContext(getStack().getContext()).getParameters(); } Map newParams = (parentParams != null) ? new HashMap(parentParams) : new HashMap(); if (parameters != null) { newParams.putAll(parameters); } ActionContext ctx = new ActionContext(stack.getContext()); ServletContext servletContext = (ServletContext) ctx.get(ServletActionContext.SERVLET_CONTEXT); PageContext pageContext = (PageContext) ctx.get(ServletActionContext.PAGE_CONTEXT); Map session = ctx.getSession(); Map application = ctx.getApplication(); DispatcherUtils.initialize(servletContext); DispatcherUtils du = DispatcherUtils.getInstance(); Map extraContext = du.createContextMap(new RequestMap(req), newParams, session, application, req, res, servletContext); OgnlValueStack newStack = new OgnlValueStack(stack); extraContext.put(ActionContext.VALUE_STACK, newStack); // add page context, such that ServletDispatcherResult will do an include extraContext.put(ServletActionContext.PAGE_CONTEXT, pageContext); return extraContext; }
Map parameters = ac.getParameters();
String token = TokenHelper.getToken(tokenName); Map params = ac.getParameters(); params.remove(tokenName); params.remove(TokenHelper.TOKEN_NAME_FIELD);
setActionName( savedInvocation.getActionName() ); setMethod( savedInvocation.getMethodName() ); invocation.getInvocationContext().getParameters().putAll( savedInvocation.getParametersMap() ); tracker.unsetBackTrack();
((ParameterAware) action).setParameters(context.getParameters());