private static String translateVariable(String input) { OgnlValueStack valueStack = ServletActionContext.getContext().getValueStack(); String output = TextParseUtil.translateVariables(input, valueStack); return output; }
/** * Sets the optional HTTP response status code and also re-sets HTTP headers after they've * been optionally evaluated against the ValueStack. * * @param invocation an encapsulation of the action execution state. * @throws Exception if an error occurs when re-setting the headers. */ public void execute(ActionInvocation invocation) throws Exception { HttpServletResponse response = ServletActionContext.getResponse(); if (status != -1) { response.setStatus(status); } if (headers != null) { OgnlValueStack stack = ActionContext.getContext().getValueStack(); for (Iterator iterator = headers.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String value = (String) entry.getValue(); String finalValue = parse ? TextParseUtil.translateVariables(value, stack) : value; response.addHeader((String) entry.getKey(), finalValue); } } } }
protected Context createContext(HttpServletRequest request, HttpServletResponse response) { return velocityManager.createContext(ActionContext.getContext().getValueStack(), request, response); }
LOG.debug("start interception"); final OgnlValueStack stack = ActionContext.getContext().getValueStack(); HttpServletRequest request = ServletActionContext.getRequest();
/** * @see LocaleResolver#resolveLocale(HttpServletRequest) */ public Locale resolveLocale(HttpServletRequest request) { Locale result = null; OgnlValueStack stack = ActionContext.getContext().getValueStack(); Iterator iterator = stack.getRoot().iterator(); while (iterator.hasNext()) { Object o = iterator.next(); if (o instanceof LocaleProvider) { LocaleProvider lp = (LocaleProvider) o; result = lp.getLocale(); break; } } if (result == null) { log.debug("Missing LocalProvider actions, init locale to default"); result = Locale.getDefault(); } return result; }
/** * @see LocaleResolver#resolveLocale(PageContext) */ @Override public Locale resolveLocale(PageContext pageContext) { Locale result = null; OgnlValueStack stack = ActionContext.getContext().getValueStack(); Iterator<Object> iterator = stack.getRoot().iterator(); while (iterator.hasNext()) { Object o = iterator.next(); if (o instanceof LocaleProvider) { LocaleProvider lp = (LocaleProvider) o; result = lp.getLocale(); break; } } if (result == null) { log.debug("Missing LocalProvider actions, init locale to default"); result = Locale.getDefault(); } return result; }
public void beforeResult(ActionInvocation invocation, String resultCode) { String key = getKey(invocation); Map app = ActionContext.getContext().getApplication(); final OgnlValueStack stack = ActionContext.getContext().getValueStack();
OgnlValueStack stack = ActionContext.getContext().getValueStack(); location = TextParseUtil.translateVariables(location, stack);
/** * S2ComponentMapをValueStackに追加します。 * */ public String intercept(ActionInvocation invocation) throws Exception { if (container == null && SingletonS2ContainerFactory.hasContainer()) { container = SingletonS2ContainerFactory.getContainer(); } Map map = new S2ComponentMap(container.getRoot()); ActionContext.getContext().getValueStack().getRoot().add(map); return invocation.invoke(); }
OgnlValueStack stack = ctx.getValueStack(); if (stack != null) { attribute = stack.findValue(s);
final OgnlValueStack stack = ActionContext.getContext().getValueStack();
Context context = vm.createContext(ctx.getValueStack(), req, res);
SimpleHash model = fmm.buildTemplateModel(ctx.getValueStack(), null, servletContext, req, res, config.getObjectWrapper());
protected TemplateModel createModel(ObjectWrapper wrapper, ServletContext servletContext, HttpServletRequest request, HttpServletResponse response) throws TemplateModelException { OgnlValueStack stack = ServletActionContext.getContext().getValueStack(); Object action = null; if (ServletActionContext.getContext().getActionInvocation() != null) { action = ServletActionContext.getContext().getActionInvocation().getAction(); } TemplateModel model = FreemarkerManager.getInstance().buildTemplateModel(stack, action, servletContext, request, response, wrapper); return model; }
/** * Build the instance of the ScopesHashModel, including JspTagLib support * <p/>Objects added to the model are <p/> * <ul> * <li>Application - servlet context attributes hash model * <li>JspTaglibs - jsp tag lib factory model * <li>Request - request attributes hash model * <li>Session - session attributes hash model * <li>req - the HttpServletRequst object for direct access * <li>res - the HttpServletResponse object for direct access * <li>stack - the OgnLValueStack instance for direct access * <li>ognl - the instance of the OgnlTool * <li>action - the action itself * <li>exception - optional : the JSP or Servlet exception as per the * servlet spec (for JSP Exception pages) * <li>webwork - instance of the WebWorkUtil class * </ul> */ protected TemplateModel createModel() throws TemplateModelException { ServletContext servletContext = ServletActionContext .getServletContext(); HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); OgnlValueStack stack = ServletActionContext.getContext() .getValueStack(); return FreemarkerManager.getInstance().buildTemplateModel(stack, invocation.getAction(), servletContext, request, response, wrapper); }
OgnlValueStack stack = ActionContext.getContext().getValueStack();
/** * Build the instance of the ScopesHashModel, including JspTagLib support * <p/> * Objects added to the model are * <p/> * <ul> * <li>Application - servlet context attributes hash model * <li>JspTaglibs - jsp tag lib factory model * <li>Request - request attributes hash model * <li>Session - session attributes hash model * <li>req - the HttpServletRequst object for direct access * <li>res - the HttpServletResponse object for direct access * <li>stack - the OgnLValueStack instance for direct access * <li>ognl - the instance of the OgnlTool * <li>action - the action itself * <li>exception - optional : the JSP or Servlet exception as per the servlet spec (for JSP Exception pages) * <li>webwork - instance of the WebWorkUtil class * </ul> */ protected TemplateModel createModel() throws TemplateModelException { ServletContext servletContext = ServletActionContext.getServletContext(); HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); OgnlValueStack stack = ServletActionContext.getContext().getValueStack(); Object action = null; if(invocation!= null ) action = invocation.getAction(); //Added for NullPointException return FreemarkerManager.getInstance().buildTemplateModel(stack, action, servletContext, request, response, wrapper); }
ActionInvocation invocation) throws Exception { prepareServletActionContext(); OgnlValueStack stack = ActionContext.getContext().getValueStack();
/** * Create a Freemarker's Model through {@link FreemarkerManager#buildTemplateModel(OgnlValueStack, Object, ServletContext, HttpServletRequest, HttpServletResponse, ObjectWrapper)}. * * @return * @throws TemplateException */ protected SimpleHash createModel() throws TemplateException { FreemarkerManager freemarkerManager = FreemarkerManager.getInstance(); ActionInvocation invocation = ActionContext.getContext().getActionInvocation(); ServletContext servletContext = JspSupportServlet.jspSupportServlet.getServletContext(); OgnlValueStack stack = ActionContext.getContext().getValueStack(); ObjectWrapper wrapper = freemarkerManager.getConfiguration(servletContext).getObjectWrapper(); Object action = null; if(invocation!= null ) action = invocation.getAction(); //Added for NullPointException return freemarkerManager.buildTemplateModel(stack, action, servletContext, request, response, wrapper); } }