轉(zhuǎn)載地址:
http://zwllxs.iteye.com/blog/1070429
在一次做非常復(fù)雜的ajax應(yīng)用時(shí),如果一個(gè)會(huì)話已經(jīng)超時(shí),但是此時(shí)再通過(guò)ajax請(qǐng)求,那么ajax返回的則是一個(gè)登陸頁(yè)面的html,那這下就慘了,頁(yè)面上而已就亂了,那么,能否在java端,如攔截器里判斷客戶的的請(qǐng)求是否是ajax請(qǐng)求呢,經(jīng)過(guò)查詢,能. 普通請(qǐng)求與ajax請(qǐng)求的報(bào)文頭不一樣,通過(guò)如下
Java代碼
String requestType = request.getHeader("X-Requested-With");
如果requestType能拿到值,并且值為XMLHttpRequest,表示客戶端的請(qǐng)求為異步請(qǐng)求,那自然是ajax請(qǐng)求了,反之如果為null,則是普通的請(qǐng)求
posted @
2012-08-01 16:20 leafcold 閱讀(346) |
評(píng)論 (0) |
編輯 收藏
AOP在spring的controller里無(wú)效的問(wèn)題
Controller的AOP需要寫在servlet.xml里
posted @
2012-07-12 17:57 leafcold 閱讀(532) |
評(píng)論 (0) |
編輯 收藏
nexus擴(kuò)展maven庫(kù)
1、http://repository.jboss.org/nexus/content/groups/public/ 為了hibernate
2、https://repository.jboss.org/nexus/content/groups/public-jboss/ 主要是birt report
3、http://mirrors.ibiblio.org/pub/mirrors/maven2/
4、http://maven.springframework.org/release/ spring amqp等
5、https://maven.alfresco.com/nexus/content/groups/public/ activiti
posted @
2012-07-12 11:10 leafcold 閱讀(201) |
評(píng)論 (0) |
編輯 收藏
hibernate.cache.region.factory_class=net.sf.ehcache.hibernate.EhCacheRegionFactory
報(bào)
ClassNotFoundException: org.hibernate.cache.TimestampsRegion
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
報(bào)
ClassNotFoundException: org.hibernate.cache.ehcache.EhCacheRegionFactory
后來(lái)找到原因,
net.sf.ehcache.hibernate.EhCacheRegionFactory 不支持hibernate4
hibernate4支持ehcache的話,需要引入
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.1.2.Final</version>
</dependency>
參考地址:http://forums.terracotta.org/forums/posts/list/6674.page
posted @
2012-06-27 16:36 leafcold 閱讀(1334) |
評(píng)論 (0) |
編輯 收藏
ab的全稱是ApacheBench,是 Apache 附帶的一個(gè)小工具,專門用于 HTTP Server 的benchmark testing,可以同時(shí)模擬多個(gè)并發(fā)請(qǐng)求。
下面的方法是在不安裝apache的情況下,使用ab工具,
ab執(zhí)行需要以下依賴,以下的安裝文件在Centos安裝盤下都可以找的到
rpm -ivh apr-1.3.9-3.el6.i686.rpm
rpm -ivh apr-util-1.3.9-3.el6_0.1.i686.rpm
httpd-tools-2.2.15-9.el6.centos.i686.rpm
解壓縮
rpm2cpio httpd-tools-2.2.15-9.el6.centos.i686.rpm | cpio -idmv
將usr/bin 下面的文件復(fù)制 /usr/bin
同理將usr/share下的文件復(fù)制到/usr/share下對(duì)應(yīng)目錄下
不僅僅是只有ab工具,還有htdbm htdigest htpasswd logresolve工具
posted @
2012-06-03 12:36 leafcold 閱讀(486) |
評(píng)論 (0) |
編輯 收藏