/** * Given a value stack, a Velocity engine, and an action invocation, this method returns the appropriate * Velocity template to render. * * @param stack the value stack to resolve the location again (when parse equals true) * @param velocity the velocity engine to process the request against * @param invocation an encapsulation of the action execution state. * @param location the location of the template * @param encoding the charset encoding of the template * @return the template to render * @throws Exception when the requested template could not be found */ protected Template getTemplate(OgnlValueStack stack, VelocityEngine velocity, ActionInvocation invocation, String location, String encoding) throws Exception { if (!location.startsWith("/")) { location = invocation.getProxy().getNamespace() + "/" + location; } Template template = velocity.getTemplate(location, encoding); return template; }
public SavedActionInvocation( ActionInvocation invocation ) { namespace = invocation.getProxy().getNamespace(); actionName = invocation.getProxy().getActionName(); methodName = invocation.getProxy().getMethod(); parameterMap = new HashMap(); parameterMap.putAll( invocation.getInvocationContext().getParameters() ); }
/** * Given a value stack, a Velocity engine, and an action invocation, this * method returns the appropriate Velocity template to render. * * @param stack the value stack to resolve the location again (when parse * equals true) * @param velocity the velocity engine to process the request against * @param invocation an encapsulation of the action execution state. * @param location the location of the template * @param encoding the charset encoding of the template * @return the template to render * @throws Exception when the requested template could not be found */ protected Template getTemplate(OgnlValueStack stack, VelocityEngine velocity, ActionInvocation invocation, String location, String encoding) throws Exception { if (!location.startsWith("/")) { location = invocation.getProxy().getNamespace() + "/" + location; } Template template = velocity.getTemplate(location, encoding); return template; }
private String getKey(ActionInvocation invocation) { ActionProxy proxy = invocation.getProxy(); if (key == null || "CLASS".equals(key)) { return "webwork.ScopeInterceptor:" + proxy.getAction().getClass(); } else if ("ACTION".equals(key)) { return "webwork.ScopeInterceptor:" + proxy.getNamespace() + ":" + proxy.getActionName(); } return key; }
public Method extractMethod(ActionInvocation invocation) throws NoSuchMethodException { return invocation.getProxy().getConfig().getMethod(); } }
public void execute(ActionInvocation invocation) throws Exception { actionName = conditionalParse(actionName, invocation); if (namespace == null) { namespace = invocation.getProxy().getNamespace(); } else { namespace = conditionalParse(namespace, invocation); ResultConfig resultConfig = (ResultConfig) invocation.getProxy().getConfig().getResults().get( invocation.getResultCode()); Map resultConfigParams = resultConfig.getParams();
public static String buildNamespace(OgnlValueStack stack, HttpServletRequest request) { ActionContext context = new ActionContext(stack.getContext()); ActionInvocation invocation = context.getActionInvocation(); if (invocation == null) { ActionMapper mapper = ActionMapperFactory.getMapper(); ActionMapping mapping = mapper.getMapping(request); if (mapping != null) { return mapping.getNamespace(); } else { // well, if the ActionMapper can't tell us, and there is no existing action invocation, // let's just go with a default guess that the namespace is the last the path minus the // last part (/foo/bar/baz.xyz -> /foo/bar) String path = RequestUtils.getServletPath(request); return path.substring(0, path.lastIndexOf("/")); } } else { return invocation.getProxy().getNamespace(); } } }
public String intercept( ActionInvocation invocation ) throws Exception { String result; try { result = invocation.invoke(); } catch ( Exception e ) { List exceptionMappings = invocation.getProxy().getConfig().getExceptionMappings(); String mappedResult = this.findResultFromExceptionMappings( exceptionMappings, e ); if ( mappedResult != null ) { result = mappedResult; if ( result.equals( IGNORE ) ) { throw e; } publishException( invocation, new ExceptionHolder( e ) ); } else { throw e; } } return result; }
savedContext.getContextMap().put(ServletActionContext.HTTP_RESPONSE, response); Result result = savedInvocation.getResult(); if ((result != null) && (savedInvocation.getProxy().getExecuteResult())) { synchronized (context) { result.execute(savedInvocation); invocation.getProxy().setExecuteResult(false);
public String intercept(ActionInvocation actionInvocation) throws Exception { ActionProxy proxy = actionInvocation.getProxy(); String name = proxy.getActionName(); ActionContext context = actionInvocation.getInvocationContext();
ActionProxy proxy = invocation.getProxy(); log.debug(getTextMessage("webwork.messages.bypass.request", new Object[]{proxy.getNamespace(), proxy.getActionName()}, ActionContext.getContext().getLocale()));
/** * Retrieves the 'real' {@link ActionConfig) for the current context. This is different * to what is available in via the {@link com.opensymphony.xwork.ActionContext#getContext()} * method because that come from the 'runtime' configuration which has been generated separately. * * @return The original {@link ActionConfig} for the current context. */ public ActionConfig getCurrentActionConfig() { if ( ActionContext.getContext() != null && ActionContext.getContext().getActionInvocation() != null && ActionContext.getContext().getActionInvocation().getProxy() != null ) { ActionConfig currentAction = ActionContext.getContext().getActionInvocation().getProxy().getConfig(); ActionRequest request = null; try { request = ActionRequest.parse( ActionContext.getContext().getName() ); PackageConfig packageConfig = ConfigurationManager.getConfiguration().getPackageConfig( currentAction.getPackageName() ); if ( packageConfig != null ) return (ActionConfig) packageConfig.getActionConfigs().get( request.getActionName() ); } catch ( ConveyorException e ) { } } return null; }
public String intercept( ActionInvocation actionInvocation ) throws Exception { ActionContext actionContext = actionInvocation.getInvocationContext(); ActionConfig actionConfig = actionInvocation.getProxy().getConfig(); String methodName = actionConfig != null ? actionConfig.getMethodName() : null; String actionName = actionContext != null ? actionContext.getName() : null;