Skip to content

Commit

Permalink
update document
Browse files Browse the repository at this point in the history
  • Loading branch information
xuxueli committed Apr 21, 2020
1 parent c46de79 commit 2fa3b0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
* web mvc config
*
* @author xuxueli 2018-04-02 20:48:20
*/
@Configuration
public class MyWebMvcConfigurer extends WebMvcConfigurerAdapter {
public class MyWebMvcConfigurer implements WebMvcConfigurer {

@Resource
private PermissionInterceptor permissionInterceptor;

@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new PermissionInterceptor()).addPathPatterns("/**");
super.addInterceptors(registry);
registry.addInterceptor(permissionInterceptor).addPathPatterns("/**");
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.xxl.sso.server.controller.interceptor;

import org.springframework.web.method.HandlerMethod;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

Expand All @@ -10,17 +10,14 @@
/**
* @author xuxueli 2015-12-12 18:09:04
*/
@Component
public class PermissionInterceptor implements HandlerInterceptor {


@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

if (!(handler instanceof HandlerMethod)) {
return true;
}

// TODO
// do something

return true;
}
Expand Down

0 comments on commit 2fa3b0e

Please sign in to comment.