Commit 9b4ac9aa3349f9916c74bab7894a3c1875872eb6
1 parent
eaa0dfe3
update
Showing
3 changed files
with
19 additions
and
18 deletions
src/main/java/com/bsth/common/Constants.java
| ... | ... | @@ -29,7 +29,7 @@ public class Constants { |
| 29 | 29 | //public static final String XD_TEMPS = "/pages/control/line/temps/**"; |
| 30 | 30 | |
| 31 | 31 | //车载网关上行接口 |
| 32 | - public static final String UPSTREAM_URL = "/control/upstream/"; | |
| 32 | + public static final String UPSTREAM_URL = "/control/upstream"; | |
| 33 | 33 | |
| 34 | 34 | public static final String SESSION_USERNAME = "sessionUserName"; |
| 35 | 35 | public static final String COMPANY_AUTHORITYS = "cmyAuths"; | ... | ... |
src/main/java/com/bsth/security/filter/LoginInterceptor.java
| ... | ... | @@ -8,10 +8,7 @@ import com.bsth.util.RequestUtils; |
| 8 | 8 | import org.springframework.security.core.Authentication; |
| 9 | 9 | import org.springframework.security.core.context.SecurityContextHolder; |
| 10 | 10 | |
| 11 | -import javax.servlet.FilterChain; | |
| 12 | -import javax.servlet.ServletException; | |
| 13 | -import javax.servlet.ServletRequest; | |
| 14 | -import javax.servlet.ServletResponse; | |
| 11 | +import javax.servlet.*; | |
| 15 | 12 | import javax.servlet.http.HttpServletRequest; |
| 16 | 13 | import javax.servlet.http.HttpServletResponse; |
| 17 | 14 | import java.io.IOException; |
| ... | ... | @@ -26,7 +23,7 @@ import java.util.Map; |
| 26 | 23 | * @date 2016年3月24日 上午11:49:20 |
| 27 | 24 | * |
| 28 | 25 | */ |
| 29 | -public class LoginInterceptor extends BaseFilter{ | |
| 26 | +public class LoginInterceptor extends BaseFilter { | |
| 30 | 27 | |
| 31 | 28 | @Override |
| 32 | 29 | public void destroy() { |
| ... | ... | @@ -34,16 +31,19 @@ public class LoginInterceptor extends BaseFilter{ |
| 34 | 31 | } |
| 35 | 32 | |
| 36 | 33 | @Override |
| 37 | - public void doFilter(ServletRequest arg0, ServletResponse arg1, | |
| 38 | - FilterChain arg2) throws IOException, ServletException { | |
| 39 | - | |
| 34 | + public void init(FilterConfig filterConfig) throws ServletException { | |
| 35 | + | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public void doFilter(HttpServletRequest request, | |
| 40 | + HttpServletResponse response, FilterChain chain) | |
| 41 | + throws IOException, ServletException { | |
| 40 | 42 | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
| 41 | - | |
| 43 | + | |
| 42 | 44 | if(null == authentication){ |
| 43 | 45 | //没有登录 |
| 44 | - HttpServletRequest request = (HttpServletRequest)arg0; | |
| 45 | - HttpServletResponse response = ((HttpServletResponse)arg1); | |
| 46 | - | |
| 46 | + | |
| 47 | 47 | if(RequestUtils.isAjaxRequest(request)){ |
| 48 | 48 | Map<String, Object> map = new HashMap<>(); |
| 49 | 49 | map.put("status", |
| ... | ... | @@ -52,10 +52,11 @@ public class LoginInterceptor extends BaseFilter{ |
| 52 | 52 | } |
| 53 | 53 | else |
| 54 | 54 | response.sendRedirect(Constants.LOGIN_PAGE); |
| 55 | - | |
| 55 | + | |
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | - | |
| 59 | - arg2.doFilter(arg0, arg1); | |
| 58 | + | |
| 59 | + chain.doFilter(request, response); | |
| 60 | 60 | } |
| 61 | + | |
| 61 | 62 | } | ... | ... |
src/main/resources/ms-jdbc.properties
| ... | ... | @@ -4,6 +4,6 @@ |
| 4 | 4 | #ms.mysql.password= 123456 |
| 5 | 5 | |
| 6 | 6 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 7 | -ms.mysql.url= jdbc:mysql://192.168.168.117:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 7 | +ms.mysql.url= jdbc:mysql://192.168.168.171:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 8 | 8 | ms.mysql.username= root |
| 9 | -ms.mysql.password= root | |
| 10 | 9 | \ No newline at end of file |
| 10 | +ms.mysql.password= root2jsp | |
| 11 | 11 | \ No newline at end of file | ... | ... |