pid
Spring Boot
过滤器
配置过滤器 Filter 来对特定类的方法做是否登录的判断
添加 Filter 的方法:
- 创建过滤器
public class EncodingFilter implements Filter { private static final String CONTENT_TYPE = "text/html;charset=UTF-8"; public EncodingFilter() { } public void destroy() { } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); chain.doFilter(request, response); } public void init(FilterConfig filterConfig) throws ServletException { } }
- 配置类注解
@Configuration
- 配置类方法注解
@Bean
- 配置类方法内容:
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); filterRegistrationBean.setOrder(3); // 设置过滤顺序,越小越先执行 filterRegistrationBean.setFilter(new YourFilter()); // 设置过滤器 filterRegistrationBean.setName("customFilter"); // 设置过滤器名称 filterRegistrationBean.addUrlPatterns("*.action"); // 设置使用该过滤器的 Url 特征 return filterRegistrationBean;
Docker 镜像拉取失败的几种解决方法
方法总览:
- 国内源
- nc + hosts
- Nginx 代理(需要 VPS)
- 官方 registry(需要 VPS,可缓存镜像)
- JFrog Artifactory(需要 VPS,可缓存镜像,需要许可证)
Docker 拉取镜像的流程
刷错 BootLoader 导致硬件启动错误的修复方法
小米路由3 刷 OpenWRT
步骤:
- 开启 SSH
- 用 XShell 登录
- 挂载 U 盘
- 备份 MTD
- 刷 Breed (Bootloader)
- 不使用 Breed 刷 OpenWRT
开启 SSH 登录
进入官网:
登录并绑定路由器。此时可以得到 账号和密码。