1. 最近在研究Shiro的过程中,碰到DefaultFilter的源码,是enum形式的。之前没见过这样的写法。
待解决。
--> 已解决:http://www.cnblogs.com/hello-yz/p/5737134.html
public enum DefaultFilter { anon(AnonymousFilter.class), authc(FormAuthenticationFilter.class), authcBasic(BasicHttpAuthenticationFilter.class), logout(LogoutFilter.class), noSessionCreation(NoSessionCreationFilter.class), perms(PermissionsAuthorizationFilter.class), port(PortFilter.class), rest(HttpMethodPermissionFilter.class), roles(RolesAuthorizationFilter.class), ssl(SslFilter.class), user(UserFilter.class); private final Class<? extends Filter> filterClass; private DefaultFilter(Class<? extends Filter> filterClass) { this.filterClass = filterClass; } public Filter newInstance() { return (Filter) ClassUtils.newInstance(this.filterClass); } public Class<? extends Filter> getFilterClass() { return this.filterClass; } public static Map<String, Filter> createInstanceMap(FilterConfig config) { Map<String, Filter> filters = new LinkedHashMap<String, Filter>(values().length); for (DefaultFilter defaultFilter : values()) { Filter filter = defaultFilter.newInstance(); if (config != null) { try { filter.init(config); } catch (ServletException e) { String msg = "Unable to correctly init default filter instance of type " + filter.getClass().getName(); throw new IllegalStateException(msg, e); } } filters.put(defaultFilter.name(), filter); } return filters; } }
2. 再加个问题:
今天还是在研究Shiro的过程中遇到个问题,jsp页面中的form明明是post提交,但是后台request.getMethod()却得到GET!
可能是经过Shiro的一系列Filter处理后,包含自己写的Filter,其中的redirect导致POST失效,而第二次请求肯定就是GET了。
有待验证。
3. Spring MVC 下@ReponseBody返回的String是合法的Jason串,但是datatable就是不行????前后5个小时。。。
严重影响进度,不得已改用Map,ok