/** * Get the operationMode through request paramter, if <code>allowRequestParameterSwitch</code> * is 'true', else it simply returns 'NONE', meaning its neither in the 'STORE_MODE' nor * 'RETRIEVE_MODE'. * * @return String */ protected String getRequestOperationMode(ActionInvocation invocation) { String reqOperationMode = NONE; if (allowRequestParameterSwitch) { Map reqParams = (Map) invocation.getInvocationContext().get(ActionContext.PARAMETERS); boolean containsParameter = reqParams.containsKey(requestParameterSwitch); if (containsParameter) { String[] reqParamsArr = (String[]) reqParams.get(requestParameterSwitch); if (reqParamsArr != null && reqParamsArr.length > 0) { reqOperationMode = reqParamsArr[0]; } } } return reqOperationMode; }
protected synchronized ActionInvocationTracker addActionInvocation( ActionInvocation invocation ) throws ComponentLookupException { Map sessionMap = invocation.getInvocationContext().getSession(); ActionInvocationTracker tracker = (ActionInvocationTracker) sessionMap.get( ActionInvocationTracker.ROLE ); if ( tracker == null ) { ActionContext actionContext = invocation.getInvocationContext(); PlexusContainer container = (PlexusContainer) actionContext.getApplication().get( PlexusLifecycleListener.KEY ); //noinspection deprecation tracker = (ActionInvocationTracker) container.lookup( ActionInvocationTracker.ROLE, getTrackerName() ); sessionMap.put( ActionInvocationTracker.ROLE, tracker ); } tracker.addActionInvocation( invocation ); return tracker; } }
/** * Decides if this interceptor should invalidate the session or mark the session * to be invalidated upon the next request that contains this interceptor in the stack. * * @see com.opensymphony.xwork.interceptor.AroundInterceptor#after(com.opensymphony.xwork.ActionInvocation, java.lang.String) */ protected void after(ActionInvocation invocation, String result) throws Exception { SessionMap sessionMap = (SessionMap) invocation.getInvocationContext().get(ActionContext.SESSION); if (NOW.equalsIgnoreCase(type)) { if (LOG.isDebugEnabled()) LOG.debug("type=now, invalidating session now"); sessionMap.invalidate(); LOG.info("session invalidated"); } else if (NEXT_REQUEST.equalsIgnoreCase(type)) { if (LOG.isDebugEnabled()) LOG.debug("type=NextRequest, mark key in session, such that next request that have this interceptor will invalidate the session"); sessionMap.put(key, "true"); } else if (NO_OPERATION.equalsIgnoreCase(type)) { if (LOG.isDebugEnabled()) LOG.debug("no operation"); } else { LOG.warn("unrecognized type, type should be either "+NOW+", "+NEXT_REQUEST+" or "+NO_OPERATION); } }
/** * Invalidate this session if it is marked to be invalidated from previous request. * * @see com.opensymphony.xwork.interceptor.AroundInterceptor#before(com.opensymphony.xwork.ActionInvocation) */ protected void before(ActionInvocation invocation) throws Exception { SessionMap sessionMap = (SessionMap) invocation.getInvocationContext().get(ActionContext.SESSION); if (sessionMap.containsKey(key) && sessionMap.get(key).equals("true")) { if (LOG.isDebugEnabled()) LOG.debug("found marker in session indicating this is the 'next request', session should be invalidated"); sessionMap.invalidate(); LOG.info("session invalidated"); } } }
protected void before(ActionInvocation invocation) throws Exception { Map session = invocation.getInvocationContext().getSession(); ApplicationContext applicationContext = (ApplicationContext) session.get(ApplicationContextSessionListener.APP_CONTEXT_SESSION_KEY); AutowireCapableBeanFactory factory = findAutoWiringBeanFactory(applicationContext); factory.autowireBeanProperties(invocation.getAction(),autowireStrategy.intValue(),false); }
/** * A flash result, that save the current action into the http session before * invoking <code>super.doExecute(...)</code>. * * @see com.opensymphony.webwork.dispatcher.ServletRedirectResult#doExecute(java.lang.String, com.opensymphony.xwork.ActionInvocation) */ protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { // before we redirect, let's save the state in to the session Object action = invocation.getAction(); Map session = invocation.getInvocationContext().getSession(); session.put(FlashInterceptor.DEFAULT_KEY, action); super.doExecute(finalLocation, invocation); }
ActionContext ctx = invocation.getInvocationContext(); HttpServletRequest request = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST); HttpServletResponse response = (HttpServletResponse) ctx.get(ServletActionContext.HTTP_RESPONSE);
if (action instanceof ValidationAware) { Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION);
/** * Determines what to do if an invalida token is provided. If the action implements {@link ValidationAware} * * @param invocation the action invocation where the invalid token failed * @return the return code to indicate should be processed * @throws Exception when any unexpected error occurs. */ protected String handleInvalidToken(ActionInvocation invocation) throws Exception { Object action = invocation.getAction(); String errorMessage = LocalizedTextUtil.findText(this.getClass(), "webwork.messages.invalid.token", invocation.getInvocationContext().getLocale(), "The form has already been processed or no token was supplied, please try again.", new Object[0]); if (action instanceof ValidationAware) { ((ValidationAware) action).addActionError(errorMessage); } else { log.warn(errorMessage); } return INVALID_TOKEN_CODE; }
/** * パラメータの解析を行う。 * * @param args * コマンドライン引数 * @param proxy * ActionProxy * @throws ParseException * 解析に失敗した場合 */ private void parseParameter(String[] args, ActionProxy proxy) throws ParseException { // コマンドラインパラメータを解析 Options options = new AllowAllOptions(); CommandLine cmd = parser.parse(options, args); // コマンドラインパラメータをparametersに格納 // この後ParameterInterceptorを呼び出せば、 // Actionのプロパティに同名のパラメータがセットされる Map parameters = new HashMap(); Option[] optionList = cmd.getOptions(); for (int i = 0; i < optionList.length; i++) { String parameterName = optionList[i].getOpt(); String parameterValue = optionList[i].getValue(); if (parameterValue != null) { parameters.put(parameterName, parameterValue); } } proxy.getInvocation().getInvocationContext().setParameters(parameters); proxy.getInvocation().getInvocationContext().put(CMD, cmd); }
public SavedActionInvocation( ActionInvocation invocation ) { namespace = invocation.getProxy().getNamespace(); actionName = invocation.getProxy().getActionName(); methodName = invocation.getProxy().getMethod(); parameterMap = new HashMap(); parameterMap.putAll( invocation.getInvocationContext().getParameters() ); }
if (action instanceof ValidationAware) { Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION); ValidationAware validationAwareAction = (ValidationAware) action;
PlexusContainer plexusContainer = (PlexusContainer) actionInvocation.getInvocationContext() .getApplication().get( PlexusLifecycleListener.KEY ); plexusContainer.release( action );
protected String handleInvalidToken(ActionInvocation invocation) throws Exception { ActionContext ac = invocation.getInvocationContext(); request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, stack); ActionContext savedContext = savedInvocation.getInvocationContext(); savedContext.getContextMap().put(ServletActionContext.HTTP_REQUEST, request); savedContext.getContextMap().put(ServletActionContext.HTTP_RESPONSE, response);
protected boolean setupBackTrack( ActionInvocation invocation, int order ) Map session = invocation.getInvocationContext().getSession(); ActionInvocationTracker tracker = (ActionInvocationTracker) session.get( ActionInvocationTracker.ROLE ); setActionName( savedInvocation.getActionName() ); setMethod( savedInvocation.getMethodName() ); invocation.getInvocationContext().getParameters().putAll( savedInvocation.getParametersMap() ); tracker.unsetBackTrack();
final HttpServletRequest request = (HttpServletRequest)_invocation.getInvocationContext().get(WebWorkStatics.HTTP_REQUEST); final HttpServletResponse response = (HttpServletResponse)_invocation.getInvocationContext().get(WebWorkStatics.HTTP_RESPONSE); parameters.putAll(actionParametersMap); parameters.put(JRParameter.REPORT_LOCALE, _invocation.getInvocationContext().getLocale()); LayoutManager layoutManagerObj = getLayOutManagerObj(_invocation);
public String intercept(ActionInvocation actionInvocation) throws Exception { ActionProxy proxy = actionInvocation.getProxy(); String name = proxy.getActionName(); ActionContext context = actionInvocation.getInvocationContext(); Map session = context.getSession();
ActionContext ctx = invocation.getInvocationContext(); String base = ResourceUtil.getResourceBase(req); location = base + "/" + location;
public String intercept( ActionInvocation actionInvocation ) throws Exception { ActionContext actionContext = actionInvocation.getInvocationContext(); ActionConfig actionConfig = actionInvocation.getProxy().getConfig(); String methodName = actionConfig != null ? actionConfig.getMethodName() : null;
final ActionContext context = invocation.getInvocationContext();