首页 > IT职业 > IT职场 > Webflux快速入门
SpringWebflux是SpringFramework5.0添加的新功能,WebFlux本身追随当下最火的Reactive Programming而诞生的框架,那么本篇就来简述一下这个框架到底是做什么的
Undertow
Undertow API
spring-web: Undertow to Reactive Streams bridge
Tomcat
Servlet 3.1 non-blocking I/O; Tomcat API to read and write ByteBuffers vs byte[]
spring-web: Servlet 3.1 non-blocking I/O to Reactive Streams bridge
Jetty
Servlet 3.1 non-blocking I/O; Jetty API to write ByteBuffers vs byte[]
spring-web: Servlet 3.1 non-blocking I/O to Reactive Streams bridge
Servlet 3.1 container
Servlet 3.1 non-blocking I/O
spring-web: Servlet 3.1 non-blocking I/O to Reactive Streams bridge
WebHandler定义了Web请求必要一些处理行为,大家不妨想想看:WebFlux已经脱离了Servlet API,那么使用WebFlux时遇到会话机制怎么办,想要对请求过滤处理怎么办或者想要处理静态资源怎么办等等,那么WebHandler就是做这个事情的。其实在HttpHandler的基本实现类通过适配器模式及装饰模式也间接的实现了WebHandler接口:

WebHandler常见的实现类,我在这里列举一下:
WebHandlerDecorator:WebHandler的装饰器,利用装饰模式实现相关功能的扩展
HttpWebHandlerAdapter: 进行Http请求处理,同时也是HttpHandler的实现类
FilteringWebHandler:通过WebFilter进行过滤处理的类,类似于Servlet中的Filter
ExceptionHandlingWebHandler: 针对于异常的处理类
ResourceWebHandler:用于静态资源请求的处理类
DispatcherHandler:请求的总控制器,类似于WebMVC中的DispatcherServlet
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2763/viewspace-2804519/ ,如需转载,请注明出处,否则将追究法律责任。