// Path: src/main/java/com/roncoo/adminlte/util/ConfUtil.java
// public class ConfUtil {
// 
// 	private ConfUtil() {
// 	}
// 
// 	/**
// 	 * 通过静态代码块读取上传文件的验证格式配置文件,静态代码块只执行一次(单例)
// 	 */
// 	private static Properties properties = new Properties();
// 
// 	// 通过类装载器装载进来
// 	static {
// 		try {
// 			// 从类路径下读取属性文件
// 			properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("conf.properties"));
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	/**
// 	 * 根据key读取value
// 	 * 
// 	 * @param keyName
// 	 *            key
// 	 * @return
// 	 */
// 	public static String getProperty(String keyName) {
// 		return getProperty(keyName, "");
// 	}
// 
// 	/**
// 	 * 根据key读取value，key为空，返回默认值
// 	 * 
// 	 * @param keyName
// 	 *            key
// 	 * @param defaultValue
// 	 *            默认值
// 	 * @return
// 	 */
// 	public static String getProperty(String keyName, String defaultValue) {
// 		return properties.getProperty(keyName, defaultValue);
// 	}
// }
// 
// Path: src/main/java/com/roncoo/adminlte/util/Constants.java
// public final class Constants {
// 
// 	private Constants() {
// 	}
// 
// 	/**
// 	 * 常量
// 	 * 
// 	 * @author wujing
// 	 */
// 	public interface Token {
// 		public final static String RONCOO = "roncoo";
// 	}
// 
// 	/**
// 	 * 状态类型
// 	 * 
// 	 * @author wujing
// 	 */
// 	public interface Status {
// 		public final static String ZERO = "0";
// 		public final static String ONE = "1";
// 		public final static String TWO = "2";
// 		public final static String THREE = "3";
// 	}
// 
// 	/**
// 	 * 数字类型
// 	 * 
// 	 * @author wujing
// 	 * @version 1.0
// 	 */
// 	public interface Num {
// 		public final static int ZERO = 0;
// 		public final static int ONE = 1;
// 		public final static int FIVE = 5;
// 		public final static int TEN = 10;
// 	}
// 
// }


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import com.roncoo.adminlte.util.ConfUtil;
import com.roncoo.adminlte.util.Constants;

/*
 * Copyright 2015-2016 RonCoo(http://www.roncoo.com) Group.
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.roncoo.adminlte.util.interceptor;




/**
 * Session拦截器
 * 
 * @author wujing
 */
public class SessionInterceptor implements HandlerInterceptor {

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		HttpSession session = request.getSession();
		if (session == null) {
			response.sendRedirect(ConfUtil.getProperty("redirectUrl"));
			return false;
		} else {

// Path: src/main/java/com/roncoo/adminlte/util/ConfUtil.java
// public class ConfUtil {
// 
// 	private ConfUtil() {
// 	}
// 
// 	/**
// 	 * 通过静态代码块读取上传文件的验证格式配置文件,静态代码块只执行一次(单例)
// 	 */
// 	private static Properties properties = new Properties();
// 
// 	// 通过类装载器装载进来
// 	static {
// 		try {
// 			// 从类路径下读取属性文件
// 			properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("conf.properties"));
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	/**
// 	 * 根据key读取value
// 	 * 
// 	 * @param keyName
// 	 *            key
// 	 * @return
// 	 */
// 	public static String getProperty(String keyName) {
// 		return getProperty(keyName, "");
// 	}
// 
// 	/**
// 	 * 根据key读取value，key为空，返回默认值
// 	 * 
// 	 * @param keyName
// 	 *            key
// 	 * @param defaultValue
// 	 *            默认值
// 	 * @return
// 	 */
// 	public static String getProperty(String keyName, String defaultValue) {
// 		return properties.getProperty(keyName, defaultValue);
// 	}
// }
// 
// Path: src/main/java/com/roncoo/adminlte/util/Constants.java
// public final class Constants {
// 
// 	private Constants() {
// 	}
// 
// 	/**
// 	 * 常量
// 	 * 
// 	 * @author wujing
// 	 */
// 	public interface Token {
// 		public final static String RONCOO = "roncoo";
// 	}
// 
// 	/**
// 	 * 状态类型
// 	 * 
// 	 * @author wujing
// 	 */
// 	public interface Status {
// 		public final static String ZERO = "0";
// 		public final static String ONE = "1";
// 		public final static String TWO = "2";
// 		public final static String THREE = "3";
// 	}
// 
// 	/**
// 	 * 数字类型
// 	 * 
// 	 * @author wujing
// 	 * @version 1.0
// 	 */
// 	public interface Num {
// 		public final static int ZERO = 0;
// 		public final static int ONE = 1;
// 		public final static int FIVE = 5;
// 		public final static int TEN = 10;
// 	}
// 
// }


// Path: src/main/java/com/roncoo/adminlte/util/interceptor/SessionInterceptor.java
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import com.roncoo.adminlte.util.ConfUtil;
import com.roncoo.adminlte.util.Constants;

/*
 * Copyright 2015-2016 RonCoo(http://www.roncoo.com) Group.
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.roncoo.adminlte.util.interceptor;




/**
 * Session拦截器
 * 
 * @author wujing
 */
public class SessionInterceptor implements HandlerInterceptor {

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		HttpSession session = request.getSession();
		if (session == null) {
			response.sendRedirect(ConfUtil.getProperty("redirectUrl"));
			return false;
		} else {

			Object obj = session.getAttribute(Constants.Token.RONCOO);
