??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美午夜精品一区二区蜜桃,亚洲一区在线免费,999久久久久久久久6666http://www.aygfsteel.com/athrunwang/U元zh-cnThu, 22 May 2025 09:12:32 GMTThu, 22 May 2025 09:12:32 GMT60log4j.propertieshttp://www.aygfsteel.com/athrunwang/archive/2014/02/25/410305.htmlAthrunWangAthrunWangTue, 25 Feb 2014 14:52:00 GMThttp://www.aygfsteel.com/athrunwang/archive/2014/02/25/410305.htmlhttp://www.aygfsteel.com/athrunwang/comments/410305.htmlhttp://www.aygfsteel.com/athrunwang/archive/2014/02/25/410305.html#Feedback0http://www.aygfsteel.com/athrunwang/comments/commentRss/410305.htmlhttp://www.aygfsteel.com/athrunwang/services/trackbacks/410305.html#============================================================Logger CommonLog
log4j.logger.CommonLog=DEBUG, Console, LogRollingFile
# Console output...
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
# RollingFileAppender output...
log4j.appender.LogRollingFile=org.apache.log4j.RollingFileAppender
log4j.appender.LogRollingFile.File=${user.dir}/yccb/log/yccb.log
log4j.appender.LogRollingFile.Append=true
log4j.appender.LogRollingFile.MaxFileSize=46MB
log4j.appender.LogRollingFile.MaxBackupIndex=50
log4j.appender.LogRollingFile.layout=org.apache.log4j.PatternLayout
log4j.appender.LogRollingFile.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH\:mm\:ss,SSS} method\:%l%n%m%n
#============================================================Logger SkmLog
log4j.logger.SkmLog=DEBUG, DailyRollingFile
# DailyRollingFile output...
log4j.appender.DailyRollingFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DailyRollingFile.DatePattern=yyyy-MM-dd'.log'
log4j.appender.DailyRollingFile.File=${user.dir}/yccb/log/skm/skm.log 
log4j.appender.DailyRollingFile.layout=org.apache.log4j.PatternLayout
log4j.appender.DailyRollingFile.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH\:mm\:ss,SSS} method\:%l%n%m%n
 

AthrunWang 2014-02-25 22:52 发表评论
]]>
javaҎ(gu)期格式的校验http://www.aygfsteel.com/athrunwang/archive/2014/02/21/410156.htmlAthrunWangAthrunWangFri, 21 Feb 2014 05:20:00 GMThttp://www.aygfsteel.com/athrunwang/archive/2014/02/21/410156.htmlhttp://www.aygfsteel.com/athrunwang/comments/410156.htmlhttp://www.aygfsteel.com/athrunwang/archive/2014/02/21/410156.html#Feedback0http://www.aygfsteel.com/athrunwang/comments/commentRss/410156.htmlhttp://www.aygfsteel.com/athrunwang/services/trackbacks/410156.html                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
sdf.setLenient(false);
boolean b = true;
try {
sdf.parse("2002-15-11");
} catch (ParseException e) {
e.printStackTrace();
b = false;
}
System.out.println(b);


AthrunWang 2014-02-21 13:20 发表评论
]]>
MyEclipse开发WebService教程http://www.aygfsteel.com/athrunwang/archive/2014/02/20/410094.htmlAthrunWangAthrunWangThu, 20 Feb 2014 05:06:00 GMThttp://www.aygfsteel.com/athrunwang/archive/2014/02/20/410094.htmlhttp://www.aygfsteel.com/athrunwang/comments/410094.htmlhttp://www.aygfsteel.com/athrunwang/archive/2014/02/20/410094.html#Feedback0http://www.aygfsteel.com/athrunwang/comments/commentRss/410094.htmlhttp://www.aygfsteel.com/athrunwang/services/trackbacks/410094.htmlhttp://blog.csdn.net/wuxianglong/article/details/6285978

AthrunWang 2014-02-20 13:06 发表评论
]]>
公钥Q私?SSLQ讲的很生动Q? http://www.aygfsteel.com/athrunwang/archive/2014/02/19/410028.htmlAthrunWangAthrunWangWed, 19 Feb 2014 03:11:00 GMThttp://www.aygfsteel.com/athrunwang/archive/2014/02/19/410028.htmlhttp://www.aygfsteel.com/athrunwang/comments/410028.htmlhttp://www.aygfsteel.com/athrunwang/archive/2014/02/19/410028.html#Feedback0http://www.aygfsteel.com/athrunwang/comments/commentRss/410028.htmlhttp://www.aygfsteel.com/athrunwang/services/trackbacks/410028.html

1Q公钥和U钥成对出现

2Q公开的密钥叫公钥Q只有自q道的叫私?br />3Q用公钥加密的数据只有对应的U钥可以 解密
4Q用U钥加密的数据只有对应的公钥可以解密
5Q如果可以用公钥解密Q则必然是对应的U钥加的?br />6Q如果可以用U钥解密Q则 必然是对应的公钥加的?br />明白?jin)?/p>

假设一下,我找?jin)两个数字,一个是1Q一个是2。我喜欢2q个数字Q就保留hQ不告诉你们Q然 后我告诉大家Q?是我的公钥?/p>

我有一个文Ӟ不能让别人看Q我q1加密?jin)。别人找C(jin)q个文gQ但是他不知?是解密的私钥啊Q所?他解不开Q只有我可以用数?Q就是我的私钥,来解密。这h可以保护数据了(jin)?/p>

我的好朋友x用我的公?加密?jin)字WaQ加密后成了(jin)bQ?攑֜|上。别人偷C(jin)q个文gQ但是别不开Q因为别Z知道2是我的U钥Q只有我才能解密Q解密后得到a。这P我们可以传送加密的数据?jin)?/p>

现在我们知道用公钥加密,然后用私钥来解密Q就可以解决安全传输的问题(sh)(jin)。如果我用私钥加密一D|据(当然只有我可以用U钥加密Q因为只有我知道 2是我的私钥)(j)Q结果所有的人都看到我的内容?jin),因?f)他们都知道我的公钥是1Q那么这U加密有什么用处呢Q?/p>

但是我的好朋友x说有人冒充我 l他发信。怎么办呢Q我把我要发的信Q内Ҏ(gu)cQ用我的U钥2Q加密,加密后的内容是dQ发lxQ再告诉他解密看是不是c。他用我的公?解密Q发现果?是c。这个时候,他会(x)惛_Q能够用我的公钥解密的数据,必然是用我的U钥加的密。只有我知道我得U钥Q因此他可以确认确实是我发的东ѝ这h们就能确 认发送方w䆾?jin)?strong>q个q程叫做数字{֐。当然具体的q程要稍微复杂一些?strong>用私钥来加密数据Q用途就是数字签?/strong>?/p>

好,我们复习(fn)一下:(x)
1Q?公钥U钥成对出现
2Q私钥只有我知道
3Q大家可以用我的公钥l我发加密的信了(jin)
4Q大家用我的公钥解密信的内容Q看看能不能解开Q?能解开Q说明是l过我的U钥加密?jin),可以确认确实是我发的?jin)?/p>

ȝ一下结论:(x)
1Q用公钥加密数据Q用U钥来解密数?br />2Q?用私钥加密数据(数字{֐Q,用公钥来验证数字{֐?/p>

在实际的使用中,公钥不会(x)单独出现QL以数字证书的方式出现Q这hZ(jin)公钥的安 全性和有效性?/p>

二,SSL
我和我得好朋友xQ要q行安全的通信。这U通信可以是QQ聊天Q很频繁的。用我的公钥加密数据׃??jin),因?f)Q?br />1Q我的好朋友x没有公私钥对Q我怎么l他发加密的消息啊? Q注Q实际情况中Q可以双斚w有公U钥对)(j)
2Q用公私钥加密运?很费旉Q很慢,影响QQ效果?/p>

好了(jin)Q好朋友xQ找?jin)一个数?Q用我的公钥1Q加密后发给我,_(d)我们以后qq个数字来加密信息吧?我解开后,得到?jin)数?。这P只有我们两个人知道这个秘密的数字3Q别的h都不知道Q因Z们既不知x?xi)?jin)一个什么数字,加密后的内容他们也无法解开Q?我们把这个秘密的数字叫做?x)话密?/strong>?/p>

然后Q我们选择一U对U密钥算法,比如DESQ(对称法是说Q加密过E和解密q程是对U的Q用一?密钥加密Q可以用同一个密钥解密。用公U钥的算法是非对U加密算法)(j)Q来加密我们之间的通信内容。别人因Z知道3是我们的?x)话密钥Q因而无法解密?/p>

好,复习(fn)一下:(x)
1QSSL实现安全的通信
2Q通信双方使用一Ҏ(gu)者双方的公钥来传递和U定?x)话密?Q这个过E叫做握手)(j)
3Q?双方使用?x)话密钥Q来加密双方的通信内容

上面说的是原理。大家可能觉得比较复杂了(jin)Q实际用中Q比q还要复杂。不q庆(jin)q的是,好心(j)的先?者们在操作系l或者相关的软g中实C(jin)q层QLayerQ,q且起了(jin)一个难听的名字叫做SSLQ(Secure Socket LayerQ?/div>

AthrunWang 2014-02-19 11:11 发表评论
]]>HTTPShttp://www.aygfsteel.com/athrunwang/archive/2014/02/19/410022.htmlAthrunWangAthrunWangWed, 19 Feb 2014 02:48:00 GMThttp://www.aygfsteel.com/athrunwang/archive/2014/02/19/410022.htmlhttp://www.aygfsteel.com/athrunwang/comments/410022.htmlhttp://www.aygfsteel.com/athrunwang/archive/2014/02/19/410022.html#Feedback0http://www.aygfsteel.com/athrunwang/comments/commentRss/410022.htmlhttp://www.aygfsteel.com/athrunwang/services/trackbacks/410022.html文本传输安全协?/strong>Q羃写:(x)HTTPSQ?/span>pQ?span xml:lang="en">Hypertext Transfer Protocol SecureQ是文本传输协?/a>?/span>SSL/TLS的组合,用以提供加密通讯?qing)对|络服务器n份的鉴定。HTTPSq接l常被用于万l网上的交易支付和企业信息系l中敏感信息的传输?/span>HTTPS不应与在RFC 2660中定义的安全文本传输协?/a>QS-HTTPQ相淗?br />

主要思想

HTTPS的主要思想是在不安全的|络上创Z安全信道Qƈ可在使用适当的加密包?em>服务器证书可被验证且可被信Q?/em>Q对H听?a title="中间人攻? style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">中间人攻?/a>提供合理的保护?/p>

HTTPS的信ȝ(h)承基于预先安装在览器中?a title="证书颁发机构" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">证书颁发机构Q如VeriSign、Microsoft{)(j)Q意?#8220;我信任证书颁发机构告诉我应该信Q?#8221;Q。因此,一个到某网站的HTTPSq接可被信QQ?a title="当且仅当" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">当且仅当Q?/p>

  1. 用户怿他们的浏览器正确实现?jin)HTTPS且安装了(jin)正确的证书颁发机构;
  2. 用户怿证书颁发机构仅信d法的|站Q?/li>
  3. 被访问的|站提供?jin)一个有效的证书Q意卻I它是׃个被信Q的证书颁发机构签发的Q大部分览器会(x)Ҏ(gu)效的证书发出警告Q;
  4. 该证书正地验证?jin)被讉K的网站(如,讉Khttps://example时收C(jin)l?#8220;Example Inc.”而不是其它组l的证书Q;
  5. 或者互联网上相关的节点是值得信Q的,或者用L(fng)信本协议的加密层Q?a title="传输层安? style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">TLS或SSLQ不能被H听者破坏?br />

技术细?/span>

  1. pasting

与HTTP的差?/span>[~辑]

  1. ?a title="HTTP" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">HTTP?a title="l一资源定位W? style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">URL?#8220;http://”起始且默认?a title="TCP/UDP端口列表" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">端口80不同QHTTPS的URL?#8220;https://”起始且默认?a title="TCP/UDP端口列表" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">端口443?/p>

    HTTP是不安全的,且攻击者通过监听?a title="中间人攻? style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">中间人攻?/a>{手D,可以获取|站帐户和敏感信息等。HTTPS被设计ؓ(f)可防止前q攻击,qӞ在没有用旧版本的SSLӞ(j)被认为是安全的?/p>

|络?/span>[~辑]

  1. HTTP工作在应用层Q?a title="OSI模型" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">OSI模型的最高层Q,但安全协议工作在一个较低的子层Q在HTTP报文传输前对其加密,q在到达时对其解密。严格地ԌHTTPSq不是一个单独的协议Q而是对工作在一加密q接Q?a title="传输层安? style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">TLS或SSLQ上的常规HTTP协议的称呹{?/p>

    HTTPS报文中的M东西都被加密Q包括所有报头和药。除?jin)可能?a title="选择密文d" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">CCAQ参?a style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">限制节Q之外,一个攻击者所能知道的只有在两者之间有一q接q一事实?/p>

服务器设|?/span>[~辑]

  1. 要一|络服务器准备好接受HTTPSq接Q管理员必须创徏一数字证书Qƈ交由证书颁发机构{֐以ɋ览器接受。证书颁发机构会(x)验证数字证书持有人和其声明的为同一人。浏览器通常都预装了(jin)证书颁发机构的证书,所以他们可以验证该{֐?/p>

获得证书[~辑]

  1. p书颁发机构签发的证书有免费的[3][4]Q也有每q收?3[5]?500元[6]不等的?/p>

    一个组l也可能有自q证书颁发机构Q尤其是当设|浏览器来访问他们自q|站Ӟ如,q行在公司或学校局域网内的|站Q。他们可以容易地自q证书加入览器中?/p>

    此外Q还存在一个hCh的证书颁发机构,CAcert?/p>

作ؓ(f)讉K控制[~辑]

  1. HTTPS也可被用作客L(fng)认证手段来将一些信息限制给合法的用戗要做到q样Q管理员通常?x)给每个用户创徏证书Q通常包含?jin)用L(fng)名字和电(sh)子邮件地址Q。这个证书会(x)被放|在览器中Qƈ在每ơ连接到服务器时由服务器(g)查?/p>

当私钥失密时[~辑]

  1. 证书可在其过期前被吊销Q通常情况是该证书的私钥已l失密。较新的览器如Google Chrome?a title="Firefox" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">Firefox[7]?a title="Opera" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">Opera[8]和运行在Windows Vista上的Internet Explorer[9]都实C(jin)在线证书状态协?/a>QOCSPQ以排除q种情ŞQ浏览器网站提供的证书的串行号通过OCSP发送给证书颁发机构Q后者会(x)告诉览器证书是否还是有效的?sup id="cite_ref-10" style="unicode-bidi: -webkit-isolate;">[10]

局?/span>[~辑]

  1. TLS有两U策略:(x)单策略和交互{略。交互策略更为安全,但需要用户在他们的浏览器中安装个人的证书来进?a title="认证" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">认证?/p>

    不管使用?jin)哪U策略,协议所能提供的保护d烈地依赖于浏览器?a title="实现Q页面不存在Q? style="text-decoration: none; color: #a55858; background-image: none; background-position: initial initial; background-repeat: initial initial;">实现和服务器软g所支持?a title="加密法Q页面不存在Q? style="text-decoration: none; color: #a55858; background-image: none; background-position: initial initial; background-repeat: initial initial;">加密法?/p>

    HTTPSq不能防止站点被|络蜘蛛抓取。在某些情Ş中,被加密资源的URL可仅通过截获h和响应的大小推得Q?sup id="cite_ref-11" style="unicode-bidi: -webkit-isolate;">[11]q就可d者同时知道明文(公开的静(rn)态内容)(j)和密文(被加密过的明文)(j)Q从而选择密文d成ؓ(f)可能?/p>

    因ؓ(f)SSL在HTTP之下工作Q对上层协议一无所知,所以SSL服务器只能ؓ(f)一个IP地址/端口l合提供一个证书?sup id="cite_ref-12" style="unicode-bidi: -webkit-isolate;">[12]q就意味着在大部分情况下,使用HTTPS的同时支?a title="虚拟L" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">Z名字的虚拟主?/a>是不很现实的。一U叫域名指示QSNIQ的Ҏ(gu)通过在加密连接创建前向服务器发送主机名解决?jin)这一问题?a title="Firefox" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">Firefox 2?a title="Opera" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">Opera8和运行在Windows Vista?a title="Internet Explorer" style="text-decoration: none; color: #0b0080; background-image: none;">Internet Explorer 7都加入了(jin)对SNI的支持?sup id="cite_ref-13" style="unicode-bidi: -webkit-isolate;">[13][14][15]

    因ؓ(f)HTTPSq接所用的公钥以明文传输,因此中国大陆?a title="防火长城" style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial;">防火长城可以对特定网站按照匹配的黑名单证书,通过伪装成对方向q接两端的计机发送RST包干C台计机间正常的TCP通讯Q以打断与特定IP地址之间?43端口握手Q或者直接握手的数据包丢弃Q导致握手失败,从而导致TLSq接p|?sup id="cite_ref-16" style="unicode-bidi: -webkit-isolate;">[16]q也是一U互联网信息审查和屏蔽的技术手Dc(din)?/p>

    如果Mac OS X中的安控制被启用,那么HTTPS站点必须昑ּ地在“L允许”列表中列出?sup id="cite_ref-17" style="unicode-bidi: -webkit-isolate;">[17]



AthrunWang 2014-02-19 10:48 发表评论
]]>
java 传?/title><link>http://www.aygfsteel.com/athrunwang/archive/2014/02/11/409739.html</link><dc:creator>AthrunWang</dc:creator><author>AthrunWang</author><pubDate>Tue, 11 Feb 2014 09:33:00 GMT</pubDate><guid>http://www.aygfsteel.com/athrunwang/archive/2014/02/11/409739.html</guid><wfw:comment>http://www.aygfsteel.com/athrunwang/comments/409739.html</wfw:comment><comments>http://www.aygfsteel.com/athrunwang/archive/2014/02/11/409739.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/athrunwang/comments/commentRss/409739.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/athrunwang/services/trackbacks/409739.html</trackback:ping><description><![CDATA[g递(pass by valueQ:(x)stackQ栈Q常量、基本数据类型(八种Q、对象引用、指令(对象的方法)(j)Q,单类型?br /><br />引用传?pss by reference)QstackQ栈Q和heapQ堆Q对象实例(object instanceQ)(j)?br /><br />stream在引用传递的q程中,不要随意关闭Q一关都养I<img src ="http://www.aygfsteel.com/athrunwang/aggbug/409739.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/athrunwang/" target="_blank">AthrunWang</a> 2014-02-11 17:33 <a href="http://www.aygfsteel.com/athrunwang/archive/2014/02/11/409739.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>double and floathttp://www.aygfsteel.com/athrunwang/archive/2014/02/11/409697.htmlAthrunWangAthrunWangTue, 11 Feb 2014 01:34:00 GMThttp://www.aygfsteel.com/athrunwang/archive/2014/02/11/409697.htmlhttp://www.aygfsteel.com/athrunwang/comments/409697.htmlhttp://www.aygfsteel.com/athrunwang/archive/2014/02/11/409697.html#Feedback0http://www.aygfsteel.com/athrunwang/comments/commentRss/409697.htmlhttp://www.aygfsteel.com/athrunwang/services/trackbacks/409697.htmldoubleQ双_ֺ点敎ͼ64位(bitsQ?字节Q?/span>它可以表C十q制?5?6位有效数字?/span>
floatQ单_ֺ点敎ͼ32位(bitsQ?字节?/span>
点QQ动小数点?/span>



AthrunWang 2014-02-11 09:34 发表评论
]]>
修改java安全讄http://www.aygfsteel.com/athrunwang/archive/2014/02/11/409694.htmlAthrunWangAthrunWangTue, 11 Feb 2014 01:11:00 GMThttp://www.aygfsteel.com/athrunwang/archive/2014/02/11/409694.htmlhttp://www.aygfsteel.com/athrunwang/comments/409694.htmlhttp://www.aygfsteel.com/athrunwang/archive/2014/02/11/409694.html#Feedback0http://www.aygfsteel.com/athrunwang/comments/commentRss/409694.htmlhttp://www.aygfsteel.com/athrunwang/services/trackbacks/409694.html
JAVA安全讄修改方式Qwindows控制面板 -> E序 -> Java -> 安全?img src ="http://www.aygfsteel.com/athrunwang/aggbug/409694.html" width = "1" height = "1" />

AthrunWang 2014-02-11 09:11 发表评论
]]>
Spring容器启动后自动执行Servletq行预处?/title><link>http://www.aygfsteel.com/athrunwang/archive/2013/09/13/404042.html</link><dc:creator>AthrunWang</dc:creator><author>AthrunWang</author><pubDate>Fri, 13 Sep 2013 05:26:00 GMT</pubDate><guid>http://www.aygfsteel.com/athrunwang/archive/2013/09/13/404042.html</guid><wfw:comment>http://www.aygfsteel.com/athrunwang/comments/404042.html</wfw:comment><comments>http://www.aygfsteel.com/athrunwang/archive/2013/09/13/404042.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/athrunwang/comments/commentRss/404042.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/athrunwang/services/trackbacks/404042.html</trackback:ping><description><![CDATA[<p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">通常做法是定义一个ServletQƈ在web.xml中配|Servlet的启动顺?lt;load-on-startup>的值在DispatcherServlet之后。但q样做的~点是在Servlet中无法用Spring的依赖注入功能,只能使用WebApplicationContext的getBean()Ҏ(gu)获取bean?/p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">扑ֈ的解军_法如下:(x)</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">1、自定义一个用于代理启动Servlet的类DelegatingServletProxyQ?div style="display: inline-block;"></div></p><div><font face="Helvetica, Tahoma, Arial, sans-serif"><span style="line-height: 25.1875px;">package com.test.common.util;</span></font></div><div></div><div>import java.io.IOException;</div><div></div><div>import javax.servlet.GenericServlet;</div><div>import javax.servlet.Servlet;</div><div>import javax.servlet.ServletException;</div><div>import javax.servlet.ServletRequest;</div><div>import javax.servlet.ServletResponse;</div><div></div><div>import org.springframework.web.context.WebApplicationContext;</div><div>import org.springframework.web.context.support.WebApplicationContextUtils;</div><div></div><div>public class DelegatingServletProxy extends GenericServlet {</div><div></div><div><span style="white-space:pre"> </span>private String targetBean;</div><div><span style="white-space:pre"> </span>private Servlet proxy;</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>@Override</div><div><span style="white-space:pre"> </span>public void service(ServletRequest arg0, ServletResponse arg1)</div><div><span style="white-space:pre"> </span>throws ServletException, IOException {</div><div><span style="white-space:pre"> </span>proxy.service(arg0, arg1);</div><div><span style="white-space:pre"> </span>}</div><div></div><div><span style="white-space:pre"> </span>@Override</div><div><span style="white-space:pre"> </span>public void init() throws ServletException {</div><div><span style="white-space:pre"> </span>this.targetBean = getServletName();</div><div><span style="white-space:pre"> </span>getServletBean();</div><div><span style="white-space:pre"> </span>proxy.init(getServletConfig());</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>private void getServletBean() {</div><div><span style="white-space:pre"> </span>WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());</div><div><span style="white-space:pre"> </span>this.proxy = (Servlet)wac.getBean(targetBean);</div><div><span style="white-space:pre"> </span>}</div><div></div><div>}</div><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">2、编写启动ServletQ?br /></p><div><font face="Helvetica, Tahoma, Arial, sans-serif"><span style="line-height: 25.1875px;">package com.test.common.util;</span></font></div><div></div><div>import java.io.IOException;</div><div>import java.util.List;</div><div></div><div>import javax.annotation.Resource;</div><div>import javax.servlet.ServletConfig;</div><div>import javax.servlet.ServletException;</div><div>import javax.servlet.http.HttpServlet;</div><div>import javax.servlet.http.HttpServletRequest;</div><div>import javax.servlet.http.HttpServletResponse;</div><div></div><div>import org.springframework.stereotype.Component;</div><div></div><div>import cn.edu.swu.oa.agency.model.Department;</div><div>import cn.edu.swu.oa.agency.model.Group;</div><div>import cn.edu.swu.oa.agency.service.DepService;</div><div>import cn.edu.swu.oa.agency.service.GroService;</div><div>import cn.edu.swu.oa.common.model.SysCode;</div><div>import cn.edu.swu.oa.safe.model.User;</div><div>import cn.edu.swu.oa.safe.service.UserService;</div><div></div><div>/**</div><div> * </div><div> *</div><div> * cd解释QSpring启动完成后执行初始化操作</div><div> * cd表述Q预L些实体的Key-ValueQ放入mapQ方便以后?/div><div> * @author </div><div> * @version </div><div> *</div><div> */</div><div>@Component("initialServlet")</div><div>public class InitialServlet extends HttpServlet {</div><div><span style="white-space:pre"> </span>private static final long serialVersionUID = 1L;</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>@Resource</div><div><span style="white-space:pre"> </span>private UserService userService;</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>@Resource</div><div><span style="white-space:pre"> </span>private DepService depService;</div><div>       </div><div><span style="white-space:pre"> </span>@Resource</div><div><span style="white-space:pre"> </span>private GroService groService;</div><div><span style="white-space:pre"> </span></div><div>    /**</div><div>     * @see HttpServlet#HttpServlet()</div><div>     */</div><div>    public InitialServlet() {</div><div>        super();</div><div>    }</div><div></div><div><span style="white-space:pre"> </span>/**</div><div><span style="white-space:pre"> </span> * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)</div><div><span style="white-space:pre"> </span> */</div><div><span style="white-space:pre"> </span>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>}</div><div></div><div><span style="white-space:pre"> </span>/**</div><div><span style="white-space:pre"> </span> * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)</div><div><span style="white-space:pre"> </span> */</div><div><span style="white-space:pre"> </span>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {</div><div><span style="white-space:pre"> </span>// TODO Auto-generated method stub</div><div><span style="white-space:pre"> </span>}</div><div></div><div><span style="white-space:pre"> </span>@Override</div><div><span style="white-space:pre"> </span>public void init(ServletConfig config) throws ServletException {</div><div><span style="white-space:pre"> </span>//初始化eserMap</div><div><span style="white-space:pre"> </span>List<User> users = userService.getUsers();</div><div><span style="white-space:pre"> </span>for(int i = 0; i < users.size(); i++) {</div><div><span style="white-space:pre"> </span>User user = users.get(i);</div><div><span style="white-space:pre"> </span>Integer userId = user.getUserId();</div><div><span style="white-space:pre"> </span>String userName = user.getUserName();</div><div><span style="white-space:pre"> </span>SysCode.userMap.put(userId, userName);</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>//初始化depMap</div><div><span style="white-space:pre"> </span>List<Department> deps = depService.getAllDeps();</div><div><span style="white-space:pre"> </span>for(int i = 0; i < deps.size(); i++) {</div><div><span style="white-space:pre"> </span>Department dep = deps.get(i);</div><div><span style="white-space:pre"> </span>Integer depId = dep.getDepId();</div><div><span style="white-space:pre"> </span>String depName = dep.getDepName();</div><div><span style="white-space:pre"> </span>SysCode.depMap.put(depId, depName);</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>//初始化groMap</div><div><span style="white-space:pre"> </span>List<Group> gros = groService.getAllGroups();</div><div><span style="white-space:pre"> </span>for(int i = 0; i < gros.size(); i++) {</div><div><span style="white-space:pre"> </span>Group gro = gros.get(i);</div><div><span style="white-space:pre"> </span>Integer groId = gro.getGroId();</div><div><span style="white-space:pre"> </span>String groName = gro.getGroName();</div><div><span style="white-space:pre"> </span>SysCode.groMap.put(groId, groName);</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>}</div><div></div><div>}</div><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"> 3、在web.xml文g中配|InitialServlet Q?br /></p><div><servlet></div><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"><br /></p><div>    <description></description></div><div>    <display-name>InitialServlet</display-name></div><div>    <servlet-name>initialServlet</servlet-name></div><div>    <servlet-class></div><div>            com.test.common.util.DelegatingServletProxy </div><div>    </servlet-class></div><div>    <load-on-startup>2</load-on-startup></div><div></servlet></div><div><servlet-mapping></div><div>    <servlet-name>initialServlet</servlet-name></div><div>    <url-pattern>/InitialServlet</url-pattern></div><div></servlet-mapping><br /><span style="background-color: #ffffff; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px;"> 完成q些操作后,可以在Spring容器启动后执行自定义的ServletQƈ且在自定义Servlet中可以用Spring Annotation的自动注入功能?<script></script></span></div><img src ="http://www.aygfsteel.com/athrunwang/aggbug/404042.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/athrunwang/" target="_blank">AthrunWang</a> 2013-09-13 13:26 <a href="http://www.aygfsteel.com/athrunwang/archive/2013/09/13/404042.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java 定时器用?/title><link>http://www.aygfsteel.com/athrunwang/archive/2013/09/13/404040.html</link><dc:creator>AthrunWang</dc:creator><author>AthrunWang</author><pubDate>Fri, 13 Sep 2013 05:24:00 GMT</pubDate><guid>http://www.aygfsteel.com/athrunwang/archive/2013/09/13/404040.html</guid><wfw:comment>http://www.aygfsteel.com/athrunwang/comments/404040.html</wfw:comment><comments>http://www.aygfsteel.com/athrunwang/archive/2013/09/13/404040.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/athrunwang/comments/commentRss/404040.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/athrunwang/services/trackbacks/404040.html</trackback:ping><description><![CDATA[<div>package com.athrunwang.test;</div><div></div><div>import java.util.Calendar;</div><div>import java.util.Date;</div><div>import java.util.Timer;</div><div>import java.util.TimerTask;</div><div></div><div>public class TestTimer {</div><div><span style="white-space:pre"> </span>static int count = 0;</div><div></div><div><span style="white-space:pre"> </span>public static void showTimer() {</div><div><span style="white-space:pre"> </span>TimerTask task = new TimerTask() {</div><div><span style="white-space:pre"> </span>@Override</div><div><span style="white-space:pre"> </span>public void run() {</div><div><span style="white-space:pre"> </span>++count;</div><div><span style="white-space:pre"> </span>System.out.println("旉=" + new Date() + " 执行? + count + "?); // 1?/div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>};</div><div></div><div><span style="white-space:pre"> </span>// 讄执行旉</div><div><span style="white-space:pre"> </span>Calendar calendar = Calendar.getInstance();</div><div><span style="white-space:pre"> </span>int year = calendar.get(Calendar.YEAR);</div><div><span style="white-space:pre"> </span>int month = calendar.get(Calendar.MONTH);</div><div><span style="white-space:pre"> </span>int day = calendar.get(Calendar.DAY_OF_MONTH);// 每天</div><div><span style="white-space:pre"> </span>// 定制每天?1:09:00执行Q?/div><div><span style="white-space:pre"> </span>calendar.set(year, month, day, 9, 54, 00);</div><div><span style="white-space:pre"> </span>Date date = calendar.getTime();</div><div><span style="white-space:pre"> </span>Timer timer = new Timer();</div><div><span style="white-space:pre"> </span>System.out.println(date);</div><div></div><div><span style="white-space:pre"> </span>int period = 2 * 1000;</div><div><span style="white-space:pre"> </span>// 每天的date时刻执行taskQ每?U重复执?/div><div><span style="white-space:pre"> </span>timer.schedule(task, date, period);</div><div><span style="white-space:pre"> </span>// 每天的date时刻执行task, 仅执行一?/div><div><span style="white-space:pre"> </span>//timer.schedule(task, date);</div><div><span style="white-space:pre"> </span>}</div><div></div><div><span style="white-space:pre"> </span>public static void main(String[] args) {</div><div><span style="white-space:pre"> </span>showTimer();</div><div><span style="white-space:pre"> </span>}</div><div>}</div><div></div><img src ="http://www.aygfsteel.com/athrunwang/aggbug/404040.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/athrunwang/" target="_blank">AthrunWang</a> 2013-09-13 13:24 <a href="http://www.aygfsteel.com/athrunwang/archive/2013/09/13/404040.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">鶴</a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">¹Ȫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">潭</a>| <a href="http://" target="_blank">׷</a>| <a href="http://" target="_blank">˷</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̨</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">տ</a>| <a href="http://" target="_blank">ʲ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ٷ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Խ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">³ľ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ٳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>