// Path: src/main/java/com/taobao/rigel/rap/common/config/SystemConstant.java
// public class SystemConstant {
//     private static final Logger logger = LogManager.getFormatterLogger(SystemConstant.class);
//     public static final int DEFAULT_PAGE_SIZE = 12;
//     public static final int ACCOUNT_LENGTH_MIN = 6;
//     public static final int ACCOUNT_LENGTH_MAX = 32;
//     public static final int NAME_LENGTH_MIN = 1;
//     public static final int NAME_LENGTH_MAX = 32;
//     public static final String ALI_LOGIN_URL = "login" + ".ali" + "ba" + "ba" + "-in" + "c.com";
//     public static final String NODE_SERVER = "localhost:7429";
//     public static String README_PATH = "";
//     public static String ROOT = "";
//     public static String DOMAIN_URL = "";
//     public static boolean serviceInitialized = false;
//     public static SimpleSSOUser user = null;
//     private static String domainURL = "";
// 
//     public static String getAliLoginUrl() {
//         return ALI_LOGIN_URL;
//     }
// 
//     public static String getDOMAIN_URL() {
//         return domainURL;
//     }
// 
//     public static void setDOMAIN_URL(String domainURL) {
//         SystemConstant.domainURL = domainURL;
//     }
// 
//     private static Properties config;
// 
//     private static void loadConfig() {
//         if (config == null) {
//             config = new Properties();
//             ClassLoader loader = Thread.currentThread().getContextClassLoader();
//             try {
//                 config.load(loader.getResourceAsStream("config.properties"));
//             } catch (IOException e) {
//                 e.printStackTrace();
//                 logger.error(e.getMessage());
//             }
//         }
//     }
// 
//     public static String getConfig(String key)  {
//         if (config == null) {
//             loadConfig();
//         }
//         return config.getProperty(key);
//     }
// 
// 
// }


import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import com.taobao.rigel.rap.common.config.SystemConstant;
import com.taobao.rigel.rap.common.utils.DateUtils;
import com.taobao.rigel.rap.common.utils.SystemVisitorLog;
import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.StrutsException;
import org.apache.struts2.util.VelocityStrutsUtil;
import org.apache.struts2.views.TagLibrary;
import org.apache.struts2.views.TagLibraryDirectiveProvider;
import org.apache.struts2.views.jsp.ui.OgnlTool;
import org.apache.struts2.views.util.ContextUtil;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.context.Context;
import org.apache.velocity.tools.view.ToolboxManager;
import org.apache.velocity.tools.view.context.ChainedContext;
import org.apache.velocity.tools.view.servlet.ServletToolboxManager;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
    }

    /**
     * This method is responsible for creating the standard VelocityContext used by all WW2 velocity views.  The
     * following context parameters are defined:
     * <p/>
     * <ul>
     * <li><strong>request</strong> - the current HttpServletRequest</li>
     * <li><strong>response</strong> - the current HttpServletResponse</li>
     * <li><strong>stack</strong> - the current {@link ValueStack}</li>
     * <li><strong>ognl</strong> - an {@link OgnlTool}</li>
     * <li><strong>struts</strong> - an instance of {@link org.apache.struts2.util.StrutsUtil}</li>
     * <li><strong>action</strong> - the current Struts action</li>
     * </ul>
     *
     * @return a new StrutsVelocityContext
     */
    public Context createContext(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
        Context result = null;
        VelocityContext[] chainedContexts = prepareChainedContexts(req, res, stack.getContext());
        StrutsVelocityContext context = new StrutsVelocityContext(chainedContexts, stack);
        Map standardMap = ContextUtil.getStandardContext(stack, req, res);
        for (Iterator iterator = standardMap.entrySet().iterator(); iterator.hasNext(); ) {
            Map.Entry entry = (Map.Entry) iterator.next();
            context.put((String) entry.getKey(), entry.getValue());
        }


        context.put("utils", new com.taobao.rigel.rap.common.utils.StringUtils());
        context.put("dateUtils", new DateUtils());
// Path: src/main/java/com/taobao/rigel/rap/common/config/SystemConstant.java
// public class SystemConstant {
//     private static final Logger logger = LogManager.getFormatterLogger(SystemConstant.class);
//     public static final int DEFAULT_PAGE_SIZE = 12;
//     public static final int ACCOUNT_LENGTH_MIN = 6;
//     public static final int ACCOUNT_LENGTH_MAX = 32;
//     public static final int NAME_LENGTH_MIN = 1;
//     public static final int NAME_LENGTH_MAX = 32;
//     public static final String ALI_LOGIN_URL = "login" + ".ali" + "ba" + "ba" + "-in" + "c.com";
//     public static final String NODE_SERVER = "localhost:7429";
//     public static String README_PATH = "";
//     public static String ROOT = "";
//     public static String DOMAIN_URL = "";
//     public static boolean serviceInitialized = false;
//     public static SimpleSSOUser user = null;
//     private static String domainURL = "";
// 
//     public static String getAliLoginUrl() {
//         return ALI_LOGIN_URL;
//     }
// 
//     public static String getDOMAIN_URL() {
//         return domainURL;
//     }
// 
//     public static void setDOMAIN_URL(String domainURL) {
//         SystemConstant.domainURL = domainURL;
//     }
// 
//     private static Properties config;
// 
//     private static void loadConfig() {
//         if (config == null) {
//             config = new Properties();
//             ClassLoader loader = Thread.currentThread().getContextClassLoader();
//             try {
//                 config.load(loader.getResourceAsStream("config.properties"));
//             } catch (IOException e) {
//                 e.printStackTrace();
//                 logger.error(e.getMessage());
//             }
//         }
//     }
// 
//     public static String getConfig(String key)  {
//         if (config == null) {
//             loadConfig();
//         }
//         return config.getProperty(key);
//     }
// 
// 
// }


// Path: src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import com.taobao.rigel.rap.common.config.SystemConstant;
import com.taobao.rigel.rap.common.utils.DateUtils;
import com.taobao.rigel.rap.common.utils.SystemVisitorLog;
import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.StrutsException;
import org.apache.struts2.util.VelocityStrutsUtil;
import org.apache.struts2.views.TagLibrary;
import org.apache.struts2.views.TagLibraryDirectiveProvider;
import org.apache.struts2.views.jsp.ui.OgnlTool;
import org.apache.struts2.views.util.ContextUtil;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.context.Context;
import org.apache.velocity.tools.view.ToolboxManager;
import org.apache.velocity.tools.view.context.ChainedContext;
import org.apache.velocity.tools.view.servlet.ServletToolboxManager;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

    }

    /**
     * This method is responsible for creating the standard VelocityContext used by all WW2 velocity views.  The
     * following context parameters are defined:
     * <p/>
     * <ul>
     * <li><strong>request</strong> - the current HttpServletRequest</li>
     * <li><strong>response</strong> - the current HttpServletResponse</li>
     * <li><strong>stack</strong> - the current {@link ValueStack}</li>
     * <li><strong>ognl</strong> - an {@link OgnlTool}</li>
     * <li><strong>struts</strong> - an instance of {@link org.apache.struts2.util.StrutsUtil}</li>
     * <li><strong>action</strong> - the current Struts action</li>
     * </ul>
     *
     * @return a new StrutsVelocityContext
     */
    public Context createContext(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
        Context result = null;
        VelocityContext[] chainedContexts = prepareChainedContexts(req, res, stack.getContext());
        StrutsVelocityContext context = new StrutsVelocityContext(chainedContexts, stack);
        Map standardMap = ContextUtil.getStandardContext(stack, req, res);
        for (Iterator iterator = standardMap.entrySet().iterator(); iterator.hasNext(); ) {
            Map.Entry entry = (Map.Entry) iterator.next();
            context.put((String) entry.getKey(), entry.getValue());
        }


        context.put("utils", new com.taobao.rigel.rap.common.utils.StringUtils());
        context.put("dateUtils", new DateUtils());
        context.put("consts", new SystemConstant());