我的过滤器哪里写错了?
<filter>
<filter-name>SetCharacterEncodingFilter</filter-name>
<filter-class>
tools.SetCharacterEncodingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharacterEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SetCharacterEncodingFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
public class SetCharacterEncodingFilter implements Filter {
protected FilterConfig filterConfig;
protected String encodingName;
protected boolean enable;
public SetCharacterEncodingFilter() {
encodingName = "UTF-8";
enable = false;
}
// 初始化
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
// 每个请求设置UTF-8
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("UTF-8");
HttpServletRequest httprequest = (HttpServletRequest) request;
HttpServletResponse httpresponse = (HttpServletResponse) response;
HttpSession session = httprequest.getSession();
AdminUser user=new AdminUser();
try { //获得在session中所记录的isLogin属性,该属性由登录部分的代码写入
user = (ActingAdminUser) session.getAttribute("user");
if (user!=null) //验证成功,继续处理
{
chain.doFilter(request, response);
} else //验证不成功,让用户登录。
{
String targetURL = httprequest.getContextPath()+"/login.jsp";
httpresponse.sendRedirect(targetURL);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void destroy() {
}
}
我想实现判断session用户是否登录了
我配了这个,是在编码过滤器那里顺便加点session判断,但是我开个网页都卡在那里,好像在反复重定向,左下角闪烁正在打开"http://localhost:8080/test/login.jsp" 和 "正在重新定向到http://localhost:8080/test/login.jsp" 我写错哪里了?
...全文
相关推荐
一种基于Java编程的脏字过滤器的设计.pdf
此外,为了提高过滤器的准确性和避免误判,可以考虑引入模糊匹配和上下文分析。模糊匹配允许一定程度的拼写错误容忍,而上下文分析则考虑词汇的语境,防止孤立的脏字片段被误认为是恶意内容。
Lucene全文搜索 分组,精确查找,模糊查找
三、Lucene模糊查找模糊查找则允许用户输入可能存在拼写错误或近义词的查询词。Lucene提供了以下几种模糊查找策略:1.
使用go语言编写的基于DFA算法的敏感词过滤器.zip
此外,为了应对逃逸检测(即通过拼写错误或空格插入等手段逃避过滤器的检测),开发者还需要不断更新和优化敏感词库以及匹配算法。
javaControleTarefaMaster:使用JSP,Spring MVC,JPA,过滤器和身份验证进行任务控制的Java应用程序
【描述】中的“javaControlTastaMaster”可能是“javaControleTarefaMaster”的拼写错误,描述中提到的应用程序是用Java开发的,它利用了Web开发的几个关键组件
蒸汽网络过滤器旁路器「Steam Web Filter Bypasser」-crx插件
为Steam的网页过滤器页面提供自动功能Steam Web Filter Bypasser是Google Chrome的扩展程序,可为Steam的Web过滤器页面提供自动旁路功能,以及其他一些有用的功


Web 开发
