Gradle 全局设置仓库镜像

~\.gradle 目录下新建文件 init.gradle, 内容如下

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
allprojects {
    repositories {
        mavenLocal()
			maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" }
			maven { name "Bstek" ; url "http://nexus.bsdn.org/content/groups/public/" }
    }

	buildscript {
		repositories {
			maven { name "Alibaba" ; url 'https://maven.aliyun.com/repository/public' }
			maven { name "Bstek" ; url 'https://nexus.bsdn.org/content/groups/public/' }
			maven { name "M2" ; url 'https://plugins.gradle.org/m2/' }
		}
	}
}

Tomcat 自定义错误页

conf/server.xml 中的 Host标签添加

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<Host name="localhost"  appBase="webapps"
      unpackWARs="true" autoDeploy="true">
  <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
         prefix="localhost_access_log" suffix=".txt"
         pattern="%h %l %u %t &quot;%r&quot; %s %b" />

    // 这是新加的
    <Valve className="org.apache.catalina.valves.ErrorReportValve"
              errorCode.400="webapps/ROOT/error.jsp"
              errorCode.0="webapps/ROOT/error.jsp"
              showReport="false"
              showServerInfo="false" />
    // 这是新加的
</Host>

上面的 error.jsp 放在 webapps/ROOT/

在 Js 中统一设置请求参数的另一种方法

  • 重写方法XMLHttpRequest.prototype.send
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

XMLHttpRequest.prototype._send = XMLHttpRequest.prototype.send
XMLHttpRequest.prototype.send = function (params) {
	var attached_params = mdcUtil.MDC_DEVICE_ID + "=" + mdcUtil.getMdcDeviceId();
	if (params) {
		params += "&" + attached_params;
	} else {
		params = attached_params;
	}
	return this._send(params)
}