spring设置webAppRootKey
今天一个同事来问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的更多相关文章
- spring设置全局异常处理器
1.spring设置全局异常,它的原理是向上捕获 spring.xml配置 <!--自定义全局异常处理器--> <bean id="globalExceptionResol ...
- Quartz在Spring中动态设置cronExpression (spring设置动态定时任务)
什么是动态定时任务:是由客户制定生成的,服务端只知道该去执行什么任务,但任务的定时是不确定的(是由客户制定). 这样总不能修改配置文件每定制个定时任务就增加一个trigger吧,即便允许客户 ...
- MyBatis与Spring设置callSettersOnNulls
项目中集成Mybatis与Spring,使用的是Mybatis3.2.7,以及Spring4.0.5,mybatis-spring-1.2.2;由于项目组成员想要偷懒,将数据从DB中查询出来时须要将字 ...
- Spring 设置readonly 事务只读模式
详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt394 在学习spring事务的时候,发现设置readOnly后不启作用. 查 ...
- Spring设置定时任务时,关于执行时间的规则设置
been需要在xml文件中进行配置 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE bean ...
- Spring设置动态定时任务
1.在Spring中经常会用到定时任务,一般会在业务方法上使用@Schedule(cron="定时执行规则"),无法实现从前台动态设置定时任务. 在java中固定频率的任务使用Sc ...
- spring:设置映射访问路径 或 xml配置访问路径 (spring mvc form表单)
项目hello, 在src/main/java下面建一个目录: charpter2 一.xml配置访问路径 web.xml <web-app> <display-name>Ar ...
- SSH框架中 Spring设置定时器 Quartz
一,首先下载quartz-1.6.0.jar架包,到lib目录下 二,写你自己定时器业务方法 package com.lbnet.lzx.timing; import org.quartz.JobEx ...
- Spring设置定时器配置
corn表达式生成:http://www.pppet.net/ 1.注解方式 添加命名空间 xmlns:task="http://www.springframework.org/schema ...
随机推荐
- 51Nod 1021 石子合并 Label:Water DP
N堆石子摆成一条线.现要将石子有次序地合并成一堆.规定每次只能选相邻的2堆石子合并成新的一堆,并将新的一堆石子数记为该次合并的代价.计算将N堆石子合并成一堆的最小代价. 例如: 1 2 3 4,有 ...
- [深入浅出WP8.1(Runtime)]生成图片和存储生成的图片文件
7.2.3 使用RenderTargetBitmap类生成图片 RenderTargetBitmap类可以将可视化对象转换为位图,也就是说它可以将任意的UIElement以位图的形式呈现.那么我们在实 ...
- 【JAVA】JMX简单使用方法
[BEAN] 配置 <!-- JMX 对应的接口服务--> <bean id="emailInterfaceServer" class="com.s ...
- 为什么用evernote
其实是没有什么为什么的. 如果真要找个理由,那应该是: 为知的界面看着总觉得很糙. 这个糙指的是不像个好软件,而装上evernote感觉就不一样. 有道笔记新版本貌似在我这儿有BUG. ...
- 转自大楚网:微软SAPI:让你的软件能说会道
[IT168专稿]“没声音,再好的戏也出不来.”这虽然是一句广告,但是也说出了一个道理,我们所开发的软件,特别是一些多媒体软件,要是能够发 出声音,能说会道,将为我们的软件增添不少光彩.同时,我们面临 ...
- Android查询系统的音频(音乐播放器的核心)
//查询系统的音频库 public static List<MusicBean> getMusicInfo(Context context){ List<MusicBean> ...
- JAVA 往jar包添加class文件
(1) jar -uf jarfile.jar yourclasses (2) 右击要打包的文件夹,选择“添加到压缩文件”,弹出对话框: 把压缩文件格式改为zip,再把压缩文件名中的反缀改为.jar, ...
- PHP脱mysql脚本
<?php $SQL_Server="xxxxxx:3306"; $SQL_User="xxxx"; $SQL_Name="xxxx" ...
- C# 文件和文件夹操作
一.文件操作 1.File类的常用静态方法: void AppendAllText(string path, string contents),将文本contents附加到文件path中 bool E ...
- filter的详细配置
我们已经了解了filter的基本用法,还有一些细节配置在特殊情况下起作用. 在servlet-2.3中,Filter会过滤一切请求,包括服务器内部使用forward转发请求和<%@ includ ...