java-filter and listener
Java Servlet 是运行在 Web 服务器或应用服务器上的程序,它是作为来自 Web 浏览器或其他 HTTP 客户端的请求和 HTTP 服务器上的数据库或应用程序之间的中间层。
使用 Servlet,您可以收集来自网页表单的用户输入,呈现来自数据库或者其他源的记录,还可以动态创建网页。
Servlet Filter is used for monitoring request and response from client to the servlet, or to modify the request and response, or to audit and log.
Servlet Listener is used for listening to events in a web containers, such as when you create a session, or place an attribute in an session or if you passivate and activate in another container, to subscribe to these events you can configure listener in web.xml, for example HttpSessionListener.
Servlet Filter
Filter is an object which transform the request and response (header as well as content).
Servlet Filter is used for manipulating the request and response from client to the servlet, or to modify the request and response, or to audit and log. Filters are called on a per-request basis and listeners are not. Filters have access to request object and listeners don’t. Filters can perform many different types of functions. We’ll discuss examples of the italicized items in this paper:
- Authentication-Blocking requests based on user identity.
- Logging and auditing-Tracking users of a web application.
- Image conversion-Scaling maps, and so on.
- Data compression-Making downloads smaller.
- Localization-Targeting the request and response to a particular locale.
- XSL/T transformations of XML content-Targeting web application responses to more that one type of client.
Servlet Listener
You can monitor and react to events in a servlet’s life cycle by defining listener objects whose methods get invoked when life cycle events occur. Servlet Listener is used for listening various events inside a web containers, such as when you create a session, or place an attribute in a session or if you passivate and activate in another container, to manipulate these events you can configure listener in web.xml, for example HttpSessionListener. Below a list of provided Listener classes:
- HttpSessionAttributeListener
- HttpSessionBindingListener
- HttpSessionListener
- ServletContextAttributeListener
- ServletContextListener
java-filter and listener的更多相关文章
- java:Filter、Listener 自定义拦截器和过滤器应用
一,Filter FilterEncoding 过滤器,统一设置servlet的编码格式. package com.dkt.filter; import java.io.IOException; im ...
- java filter、listener、servlet
listener http://www.cnblogs.com/xdp-gacl/p/3969249.html http://blog.csdn.net/java_pengjin/article/de ...
- 【Java Web开发学习】Spring MVC添加自定义Servlet、Filter、Listener
[Java Web开发学习]Spring MVC添加自定义Servlet.Filter.Listener 转载:https://www.cnblogs.com/yangchongxing/p/9968 ...
- Servlet、Filter、Listener、Interceptor
首先,JSP/Servlet规范中定义了Servlet.Filter.Listener这三种角色,并没有定义Interceptor这个角 色,Interceptor是某些MVC框架中的角色,比如Str ...
- servlet、filter、listener、interceptor之间的区别和联系
一.概念 1.servlet:servlet是一种运行服务器端的java应用程序,具有独立于平台和协议的特性,并且可以动态的生成web页面,它工作在客户端请求与服务器响应的中间层. 2.filter: ...
- j2ee Servlet、Filter、Listener
首先,JSP/Servlet规范中定义了Servlet.Filter.Listener这三种角色,并没有定义Interceptor这个角色,Interceptor是某些MVC框架中的角色,比如Stru ...
- java filter的一些理解
java filter即 java中的过滤器: 一. * web项目中只有三个组件 * 过滤器filter ↓ 级 别 * 监听器 ↓ 级 别 * servlet ...
- JavaWeb之Filter、Listener
昨天和大家介绍了一下JSON的用法,其实JSON中主要是用来和数据库交互数据的.今天给大家讲解的是Filter和Listener的用法. 一.Listenner监听器 1.1.定义 Javaweb中的 ...
- Filter、Listener 学习总结
今天我们来介绍 Filter.Listener 这两个模块一些简单的知识和应用,接下来我们开始我们的正题 ! 1. Filter(过滤器) 1.1 对 Servlet 容器调用 Servlet 的过程 ...
- SpringBoot中使用Servlet,Filter,Listener
项目最近在替换之前陈旧的框架,改用SpringBoot进行重构,初接触,暂时还没有用到Servlet,Filter,Listener的地方,但在之前回顾Servlet的生命周期时,https://ww ...
随机推荐
- 错误注入 异常行为 环境变量或代码动态激活来触发这些异常行为 模拟错误 容错性 正确性 稳定性 宏 本质 macro
小结: 1. 微服务中某个服务出现随机延迟.某个服务不可用. 存储系统磁盘 IO 延迟增加.IO 吞吐量过低.落盘时间长. 调度系统中出现热点,某个调度指令失败. 充值系统中模拟第三方重复请求充值成功 ...
- [go]json序列化
// json字段别名 type User struct { Id int `json:"id,string"` Name string `json:"username& ...
- SQL-W3School-高级:SQL 通配符
ylbtech-SQL-W3School-高级:SQL 通配符 1.返回顶部 1. 在搜索数据库中的数据时,您可以使用 SQL 通配符. SQL 通配符 在搜索数据库中的数据时,SQL 通配符可以替代 ...
- .IllegalArgumentException: Mapped Statements collection does not contain 异常一例【我】
更新代码后发现几乎所有的sql查询都报错,类似下面: java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException: ne ...
- 16 Flutter仿京东商城项目 跳转到搜索页面实现搜索功能 以及搜索筛选
ProductList.dart import 'package:flutter/material.dart'; import '../services/ScreenAdaper.dart'; imp ...
- 阶段5 3.微服务项目【学成在线】_day03 CMS页面管理开发_16-异常处理-可预知异常处理-自定义异常类型和抛出类
在common工程创建捕获异常的类:CustomException Runtime叫做运行异常.在代码中抛出的话 对我们的代码没有可侵入性 如果在代码上抛出 如果改成Exception 这时候就会有错 ...
- React Native清除缓存实现
清除缓存使用的第三方:react-native-http-cache Github: https://github.com/reactnativecn/react-native-http-cach ...
- 在Ubuntu上安装Intellij IDEA并创建桌面快捷方式
环境信息 版本号 Ubuntu 18.04 LTS Intellij IDEA 2019.1.3 1.首先从官网获取安装包 官方下载地址传送门 然后我就在下载目录下得到了tar.gz的包 2.接下来开 ...
- 01.03 vim编辑器使用
==========linux基础命令的使用==========================绝对路径:由根目录(/)开始写起的文件名或目录名称相对路径:相对于目前路径的文件名写法(开头不是/就属于 ...
- shell学习笔记2-find和xargs
1,find命令形式 find pathname -options [-print - exec -ok] pathname find命令所查找的目录路径.. 表示当前目录,/表示系统根路径 -pri ...