今天一个同事来问webAppRootKey 在哪设置的

<context-param>
<param-name>webAppRootKey</param-name>
<param-value>xxxxx.root</param-value>
</context-param>

spring干的,代码在org.springframework.web.util.WebUtils类的setWebAppRootSystemProperty方法

代码如下,简单

public static void setWebAppRootSystemProperty(ServletContext servletContext) throws IllegalStateException {
Assert.notNull(servletContext, "ServletContext must not be null");
String root = servletContext.getRealPath("/");
if (root == null) {
throw new IllegalStateException(
"Cannot set web app root system property when WAR file is not expanded");
}
String param = servletContext.getInitParameter(WEB_APP_ROOT_KEY_PARAM);
String key = (param != null ? param : DEFAULT_WEB_APP_ROOT_KEY);
String oldValue = System.getProperty(key);
if (oldValue != null && !StringUtils.pathEquals(oldValue, root)) {
throw new IllegalStateException(
"Web app root system property already set to different value: '" +
key + "' = [" + oldValue + "] instead of [" + root + "] - " +
"Choose unique values for the 'webAppRootKey' context-param in your web.xml files!");
}
System.setProperty(key, root);
servletContext.log("Set web app root system property: '" + key + "' = [" + root + "]");
}

---EOF--

spring设置webAppRootKey的更多相关文章

  1. spring设置全局异常处理器

    1.spring设置全局异常,它的原理是向上捕获 spring.xml配置 <!--自定义全局异常处理器--> <bean id="globalExceptionResol ...

  2. Quartz在Spring中动态设置cronExpression (spring设置动态定时任务)

    什么是动态定时任务:是由客户制定生成的,服务端只知道该去执行什么任务,但任务的定时是不确定的(是由客户制定).      这样总不能修改配置文件每定制个定时任务就增加一个trigger吧,即便允许客户 ...

  3. MyBatis与Spring设置callSettersOnNulls

    项目中集成Mybatis与Spring,使用的是Mybatis3.2.7,以及Spring4.0.5,mybatis-spring-1.2.2;由于项目组成员想要偷懒,将数据从DB中查询出来时须要将字 ...

  4. Spring 设置readonly 事务只读模式

    详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt394 在学习spring事务的时候,发现设置readOnly后不启作用. 查 ...

  5. Spring设置定时任务时,关于执行时间的规则设置

    been需要在xml文件中进行配置 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE bean ...

  6. Spring设置动态定时任务

    1.在Spring中经常会用到定时任务,一般会在业务方法上使用@Schedule(cron="定时执行规则"),无法实现从前台动态设置定时任务. 在java中固定频率的任务使用Sc ...

  7. spring:设置映射访问路径 或 xml配置访问路径 (spring mvc form表单)

    项目hello, 在src/main/java下面建一个目录: charpter2 一.xml配置访问路径 web.xml <web-app> <display-name>Ar ...

  8. SSH框架中 Spring设置定时器 Quartz

    一,首先下载quartz-1.6.0.jar架包,到lib目录下 二,写你自己定时器业务方法 package com.lbnet.lzx.timing; import org.quartz.JobEx ...

  9. Spring设置定时器配置

    corn表达式生成:http://www.pppet.net/ 1.注解方式 添加命名空间 xmlns:task="http://www.springframework.org/schema ...

随机推荐

  1. ACM 兄弟郊游问题

    兄弟郊游问题 时间限制:3000 ms  |  内存限制:65535 KB 难度:2   描述 兄弟俩骑车郊游,弟弟先出发,每分钟X米,M分钟后,哥哥带一条狗出发.以每分钟Y米的速度去追弟弟,而狗则以 ...

  2. UIAlertView 与 UIActionSheet (提示用户)的使用方法

    UIAlertView 提示用户  帮助用户选择框 //    UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:@"警 ...

  3. 【HDU】4336 Card Collector

    http://acm.hdu.edu.cn/showproblem.php?pid=4336 题意:n张卡片,每一次取一个盒子,盒子里装有卡片i的概率是p[i],求得到所有卡片所需要开的盒子的期望数( ...

  4. 【wikioi】1040 统计单词个数

    题目链接 算法:划分型DP PS:被卡过3天.日期:2013-10-10 ~ 2013-10-12 18:52:48 这题是我提交了13次AC= =汗= = 题目描述: 给出一个长度不超过200的由小 ...

  5. 20145330《Java程序设计》第五次实验报告

    20145330<Java程序设计>第五次实验报告 实验五 Java网络编程及安全 实验内容 1.掌握Socket程序的编写: 2.掌握密码技术的使用: 3.设计安全传输系统 4.结队伙伴 ...

  6. twitter通过oAuth验证获取json数据

    protected void Page_Load(object sender, EventArgs e) { var oAuthConsumerKey = "你的key"; var ...

  7. org.openqa.selenium.StaleElementReferenceException

    org.openqa.selenium.StaleElementReferenceException如何解啊.什么原因造成的,貌似有时会出现,有时不会出现

  8. linux下定时重启tomcat

    工具/原料 linux tomcat 方法/步骤 编写tomcat_shutdown.sh: #!/bin/sh export JAVA_HOME=/home/oracle/jdk1..0_67/ e ...

  9. Compound Words

    题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=91209#problem/C 题意:   有一堆按照字典序排好的字符串,问你有多 ...

  10. [CareerCup] 17.5 Game of Master Mind 猜字游戏

    17.5 The Came of Master Mind is played as follows: The computer has four slots, and each slot will c ...