java开发的系统,拦截器都主要起个什么作用

码农怀仔 2015-12-08 10:07:07
大神门,请教下,java开发的系统,拦截器都主要起个什么作用,主要是起拦截当没有登录的时候不能访问他的页面吗,还有别的作用吗,求大神帮忙解答下
...全文
1564 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
KK3K2005 2015-12-08
  • 打赏
  • 举报
回复
不破坏你的业务逻辑 在你的业务之外做一些其他事情
街头小贩 2015-12-08
  • 打赏
  • 举报
回复
再不懂或还有疑问多看看api Filter A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both. Filters perform filtering in the doFilter method. Every Filter has access to a FilterConfig object from which it can obtain its initialization parameters, a reference to the ServletContext which it can use, for example, to load resources needed for filtering tasks. Filters are configured in the deployment descriptor of a web application Examples that have been identified for this design are 1) Authentication Filters 2) Logging and Auditing Filters 3) Image conversion Filters 4) Data compression Filters 5) Encryption Filters 6) Tokenizing Filters 7) Filters that trigger resource access events 8) XSL/T filters 9) Mime-type chain Filter
街头小贩 2015-12-08
  • 打赏
  • 举报
回复
可作事还是挺 多的,只要作的事跟请求和响应有关。例如:访问日志(记录访客的ip,来源),在线统计人数,字符集转换,身份验证
vswen5 2015-12-08
  • 打赏
  • 举报
回复
还可以用来转码 过滤一些特殊字 检测一个账号不能重复登录。看自己需求啊 你只要明白你的每一个请求都会先进你写的拦截器在进入你写的方法

10,608

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧