Skip to content

Commit

Permalink
bugfix #69 AntPathMatcher方式
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Mar 30, 2021
1 parent b382844 commit 04508e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public EncryptionFilter(String key, List<String> responseEncryptUriList, List<St
this.encryptionConfig = new EncryptionConfig(key, responseEncryptUriList, requestDecryptUriList, responseCharset, debug);
}

private AntPathMatcher antPathMatcher = new AntPathMatcher();

@Override
public void init(FilterConfig filterConfig) throws ServletException {

Expand Down Expand Up @@ -228,7 +230,7 @@ private boolean contains(List<String> list, String uri, String methodType, HttpS

// 优先用AntPathMatcher,其实用这个也够了,底层是一样的,下面用的方式兜底
for (String u : list) {
boolean match = new AntPathMatcher().match(u, uri);
boolean match = antPathMatcher.match(u, prefixUri);
if (match) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ public UserDto save(@RequestBody UserDto dto, @PathVariable int id) {
System.err.println(dto.getId() + "\t" + dto.getName());
return dto;
}

@Encrypt
@GetMapping("/save/{id}")
public UserDto getUser(@PathVariable int id) {
UserDto dto = new UserDto();
dto.setId(id);
dto.setName("加密实体对象");
return dto;
}


@RequestMapping(value="encryptEntityXml",produces= {MediaType.APPLICATION_XML_VALUE})
public UserXmlDto encryptEntityXml() {
Expand Down

0 comments on commit 04508e1

Please sign in to comment.