private static Action getCurrentAction() { ActionContext ctx = ActionContext.getContext(); if ( ctx != null ) { ActionInvocation ai = ctx.getActionInvocation(); if ( ai != null ) return ai.getAction(); } return null; }
/** * Returns the HTTP page context. * * @return the HTTP page context. */ public static PageContext getPageContext() { return (PageContext) ActionContext.getContext().get(PAGE_CONTEXT); }
@Override public String getText(String key) { return textProvider.getText(key); }
/** * Sets the HTTP servlet request object. * * @param request the HTTP servlet request object. */ public static void setRequest(HttpServletRequest request) { ActionContext.getContext().put(HTTP_REQUEST, request); }
private void resetActionProxyFactory() { if ( originalActionProxyFactory != null ) { ActionProxyFactory.setFactory( originalActionProxyFactory ); } }
@Override public ResourceBundle getTexts() { return textProvider.getTexts(); } };
@Override public boolean hasKey(String key) { return textProvider.hasKey(key); }
/** * Reset the action context. */ private void resetActionContext() { ActionContext.setContext(null); }
/** * Gets the HTTP servlet request object. * * @return the HTTP servlet request object. */ public static HttpServletRequest getRequest() { return (HttpServletRequest) ActionContext.getContext().get(HTTP_REQUEST); }
/** * Returns the locale used for the {@link Configuration#getTemplate(String, Locale)} call. The base implementation * simply returns the locale setting of the action (assuming the action implements {@link LocaleProvider}) or, if * the action does not the configuration's locale is returned. Override this method to provide different behaviour, */ protected Locale getLocale(ActionInvocation invocation, Configuration configuration) { if (invocation.getAction() instanceof LocaleProvider) { return ((LocaleProvider) invocation.getAction()).getLocale(); } else { return configuration.getLocale(); } }
/** * Sets the HTTP servlet response object. * * @param response the HTTP servlet response object. */ public static void setResponse(HttpServletResponse response) { ActionContext.getContext().put(HTTP_RESPONSE, response); }
@Override public String getText(String key, List<?> args) { return textProvider.getText(key, args); }
@Override public ResourceBundle getTexts(String bundleName) { return textProvider.getTexts(bundleName); }
/** * Gets the servlet context. * * @return the servlet context. */ public static ServletContext getServletContext() { return (ServletContext) ActionContext.getContext().get(SERVLET_CONTEXT); }
/** * Returns the locale used for the {@link Configuration#getTemplate(String, Locale)} call. The base implementation * simply returns the locale setting of the action (assuming the action implements {@link LocaleProvider}) or, if * the action does not the configuration's locale is returned. Override this method to provide different behaviour, */ protected Locale deduceLocale() { if (invocation.getAction() instanceof LocaleProvider) { return ((LocaleProvider) invocation.getAction()).getLocale(); } else { return configuration.getLocale(); } }
@Override public String getText(String key, String defaultValue, List<?> args) { return textProvider.getText(key, defaultValue, args); }
@Override public String getText(String key, String defaultValue, List<?> args, ValueStack stack) { return textProvider.getText(key, defaultValue); }
@Override public String getText(String key, String[] args) { return textProvider.getText(key, args); }
@Override public String getText(String key, String defaultValue, String[] args) { return textProvider.getText(key, defaultValue, args); }