FileDocCategorySizeDatePackage
ContextUtil.javaAPI DocExample4073Mon Jul 23 13:26:50 BST 2007org.apache.struts2.views.util

ContextUtil

public class ContextUtil extends Object
Value Stack's Context related Utilities.

Fields Summary
public static final String
REQUEST
public static final String
REQUEST2
public static final String
RESPONSE
public static final String
RESPONSE2
public static final String
SESSION
public static final String
BASE
public static final String
STACK
public static final String
OGNL
public static final String
STRUTS
public static final String
ACTION
public static boolean
altSyntax
Constructors Summary
Methods Summary
public static java.util.MapgetStandardContext(com.opensymphony.xwork2.util.ValueStack stack, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)

        HashMap map = new HashMap();
        map.put(REQUEST, req);
        map.put(REQUEST2, req);
        map.put(RESPONSE, res);
        map.put(RESPONSE2, res);
        map.put(SESSION, req.getSession(false));
        map.put(BASE, req.getContextPath());
        map.put(STACK, stack);
        map.put(OGNL, OgnlTool.getInstance());
        map.put(STRUTS, new StrutsUtil(stack, req, res));

        ActionInvocation invocation = (ActionInvocation) stack.getContext().get(ActionContext.ACTION_INVOCATION);
        if (invocation != null) {
            map.put(ACTION, invocation.getAction());
        }
        return map;
    
public static java.lang.StringgetTemplateSuffix(java.util.Map context)
Returns a String for overriding the default templateSuffix if templateSuffix is on the stack

param
context stack's context
return
String

        return context.containsKey("templateSuffix") ? (String) context.get("templateSuffix") : null;
    
public static booleanisUseAltSyntax(java.util.Map context)
Return true if either Configuration's altSyntax is on or the stack context's useAltSyntax is on

param
context stack's context
return
boolean

        // We didn't make altSyntax static cause, if so, struts.configuration.xml.reload will not work
        // plus the Configuration implementation should cache the properties, which the framework's
        // configuration implementation does
        return altSyntax ||(
                (context.containsKey("useAltSyntax") &&
                        context.get("useAltSyntax") != null &&
                        "true".equals(context.get("useAltSyntax").toString())));
    
public static voidsetAltSyntax(java.lang.String val)

    
    
         
        altSyntax = "true".equals(val);