dean_liu
dean_liu · 共 25 篇文章
[转]Handler Mapping in Spring MVC
Handler Mapping The HandlerMapping strategy is used to map the HTTP client request to some handler controller and/or method. This is done based on the request URL and the HTTP method, but may also include the request parameters, request headers, or other custom factors. HandlerMapping Strategy Inte…
2013-10-17 11:01 · Spring · 评论(0)
[转]difference between accept and content-type http headers
Q: So the accept header tells the server the mime-type of the resource the browser is looking for. For example, the server can send plain text, html, json, etc. Ok that makes sense. But then I look at the content-type header and it looks to be doing the same thing. For example, it tells the server …
2013-10-08 17:03 · HTTP · 评论(0)
[转]浅谈 js中parseInt函数的解析
转自:http://www.cnblogs.com/anjey/archive/2012/04/13/2445430.html 首先还是从很热门的实例parseInt("09")==0说起。 parseInt(number,type)这个函数后面如果不跟第2个参数来表示进制的话,默认是10进制。 比如说parseInt("010",10)就是10进制的结果:10,parseInt("010",2)就是2进制的结果:2,parseInt("010",8)就是8进制的结果:8,parseInt("010",16)就是16进制的结果:16。 下面我来说说没有指定进制单位的时候,默认是10进制,但:…
2013-09-17 17:48 · JavaScript · 评论(0)
动态修改表单字段的配置
方法一: Ext.apply(Ext.getCmp('anyId'), {your config object}); 方法二: myField.allowBlank = true; myField.validateValue(myField.getValue()); //force update 参考: http://stackoverflow.com/questions/6098596/how-to-adding-fields-config-on-the-fly http://www.sencha.com/learn/form-faq#Set_allowBlank_dynamically
2013-09-16 14:13 · ExtJS · 评论(0)
Spring Security AJAX登录
Spring Security版本:2.0.5 重写org.springframework.security.ui.webapp.AuthenticationProcessingFilter: package com.cay.core.web; import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import …
2013-09-06 11:21 · Java · 评论(4)
Spring Security会话超时AJAX处理
Spring Security版本:2.0.5 应用场景: 用户登录系统,进行录入操作,长时间未保存,当会话超时后,用户进行保存(通过AJAX请求),系统提示“会话超时请重新登录”。 Spring Security目前的行为: Spring Security实际上是把这种请求当成未登录的请求,并抛出不允许访问的异常(org.springframework.security.AccessDeniedException),然后请求重定向到登录页面。 相关的方法有: org.springframework.security.ui.ExceptionTranslationFilter.doFilte…
2013-09-06 10:34 · Java · 评论(0)
Spring Security国际化
Spring Security版本:2.0.5 取出Spring Security的异常信息 ${sessionScope['spring_security_last_exception'].message} 异常信息已经经过国际化处理,所以只要直接取出异常的message属性即可。 如在org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(Authentication)中: ... try { user = retrieveUser(username…
2013-09-05 17:56 · Java · 评论(0)
清空日志/var/log/messages
cd /var/log lsof messages COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME rsyslogd 1455 root 4w REG 8,6 1299113404 2686 messages abrt-dump 1932 root 4r REG 8,6 1299113404 2686 messages kill -9 1455 kill -9 1932 cat /dev/null > /var/log/messages reboot
2013-08-07 18:32 · Linux · 评论(0)
memcached-session-manager备忘
1.failoverNodes (optional, must not be used for non-sticky sessions) This attribute must contain the ids of the memcached nodes, that shall not be used by this tomcat for session backup , but only if no other memcached nodes are available. Therefore, you should list those memcached nodes, that are …
2013-07-01 16:14 · Java · 评论(0)
Nginx均衡器配置
vim /usr/local/nginx/nginx.conf 1.在server节点上面增加以下节点: upstream backend{ ip_hash; server 192.168.73.206:8080; server 192.168.73.207:8080; } 2.找到: location / { root html; index index.html index.htm; } 改成: location / { proxy_pass http://backend; proxy_redirect default; proxy_connect_timeout 10; } 3.找到:…
2013-06-27 16:29 · Linux · 评论(0)
[转]Nginx安装
原文:http://www.nginx.cn/install nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息。 正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好。 ububtu平台编译环境可以使用以下指令 apt-get install build-essential apt-get install libtool cento平台编译环境使用如下指令 安装make: yum -y install gcc automake autoconf libtool make 安装g++: yum install gcc gcc…
2013-06-25 14:11 · Linux · 评论(0)
使用Keepalived进行Memcached双机热备
1.节点A mkdir -p /etc/keepalived/ vi /etc/keepalived/keepalived.conf global_defs { notification_email { admin@example.com } notification_email_from admin@ptp.cn smtp_server 127.0.0.1 stmp_connect_timeout 30 router_id HA_1 } vrrp_instance VMH1 { state MASTER interface eth0 virtual_router_id 100 priori…
2013-06-20 11:19 · Linux · 评论(0)
安装keepalived
keepalived:http://www.keepalived.org/index.html 它是一个基于VRRP协议来实现的WEB服务高可用方案,可以利用其来避免单点故障。一个WEB服务至少会有2台服务器运行Keepalived,一台为主服务器(MASTER),一台为备份服务器(BACKUP),但是对外表现为一个虚拟IP,主服务器会发送特定的消息给备份服务器,当备份服务器收不到这个消息的时候,即主服务器宕机的时候,备份服务器就会接管虚拟IP,继续提供服务,从而保证了高可用性。(摘) 1.安装ipvsadm yum -y install ipvsadm 或者 wget http://www…
2013-06-19 11:50 · Linux · 评论(0)
[转]vmware workstation 克隆linux后修改网卡为eth0方法。
原谅地址:http://www.cnblogs.com/jjkv3/archive/2012/11/14/2769613.html 场景: vmware workstation 8, guest OS:CentOS 6.2. Host OS:windows 7 问题: 克隆RHEL 6.3 后网卡名字有两个eth0和eth1,实际起作用的是eth1,eth0是克隆过来的。 由于克隆后mac地址会重新生成一个,因此系统会在原来的eth0上以为加了一个网卡因此+1为eth1. 处理办法。 方法一: 1.root登录,cp /etc/udev/rules.d/70-persistent-net.r…
2013-06-18 15:46 · Linux · 评论(0)
安装repcached memcached
分别在两台服务器中安装libevent与repcached memcached 一、安装libevent 1.先用:ls -al /usr/lib | grep libevent 查看是否已安装,如果已安装且版本低于1.3,则先通过:rpm -e libevent —nodeps 进行卸载。 2.下载libevent安装包:libevent-1.4.13-stable.tar.gz,然后解压。 3.切换到解压后的 libevent 主目录:cd libevent-1.4.13-stable 4.依次执行: ./configure --prefix=/usr (或 ./configure --…
2013-06-17 15:39 · Linux · 评论(0)