jersey 2.6小结

jersey2.6 过滤器和拦截器模块运行流程:

  • Client request invoked: The POST request with attached entity is built on the client and invoked.
  • 客户端发送POST请求,请求中内嵌客户端的实体信息。
  • ClientRequestFilters: client request filters are executed on the client and they manipulate the request headers.
  • 客户端请求过滤器:客户端请求过滤器在客户端执行,并且他们操作请求的标头类型信息。
  • Client WriterInterceptor: As the request contains an entity, writer interceptor registered on the client is executed before a MessageBodyWriter is executed. It wraps the entity output stream with the GZipOutputStream.
  • 客户端写拦截器:根据请求中包含实体信息,此前在客户端注册的写拦截器先与写消息体执行。它用GZIP输出流包装实体输出流。
  • Client MessageBodyWriter: message body writer is executed on the client which serializes the entity into the new GZipOutput stream. This stream zips the data and sends it to the "wire".
  • 客户端写消息体:写消息体在客户端被执行,它把实体序列化并形成新的Gzip输出流。这些流压缩数据并且把数据传送给服务端。
  • Server: server receives a request. Data of entity is compressed which means that pure read from the entity input stream would return compressed data.
  • 服务端:服务端接收请求。纯粹的从实体输入流读将返回被压缩的数据。
  • Server pre-matching ContainerRequestFilters: ContainerRequestFilters are executed that can manipulate resource method matching process.
  • 服务端预匹配请求过滤器:操作资源方法匹配过程。
  • Server: matching: resource method matching is done.
  • 服务端:资源方法匹配完成
  • Server: post-matching ContainerRequestFilters: ContainerRequestFilters post matching filters are executed. This include execution of all global filters (without name binding) and filters name-bound to the matched method.
  • 服务端:post匹配请求过滤器:全局过滤器和用名字绑定的过滤器中匹配的方法将执行。
  • Server ReaderInterceptor: reader interceptors are executed on the server. The GZIPReaderInterceptor wraps the input stream (the stream from the "wire") into the GZipInputStream and set it to context.
  • 服务端读拦截器:读拦截器包装输入流(从传入服务端的)成Gzip(example of GZIPReaderInterceptor)并放入容器中。
  • Server MessageBodyReader: server message body reader is executed and it deserializes the entity from new GZipInputStream (get from the context). This means the reader will read unzipped data and not the compressed data from the "wire".
  • 服务端读消息体:服务端读消息体从容器中得到的输入流反序列化实体。这意味着它将解压数据并且将解压的数据传给下一个处理对象。
  • Server resource method is executed: the deserialized entity object is passed to the matched resource method as a parameter. The method returns this entity as a response entity.
  • 服务资源方法:反序列化实体对象以参数形式被传输到匹配的资源方法。并把这个实体作为响应实体返回。
  • Server ContainerResponseFilters are executed: response filters are executed on the server and they manipulate the response headers. This include all global bound filters (without name binding) and all filters name-bound to the resource method.
  • 服务响应过滤器执行:操作响应标头信息。资源方法中的全局响应过滤器以及按名字绑定的响应过滤器都会执行。
  • Server WriterInterceptor: is executed on the server. It wraps the original output stream with a new GZIPOuptutStream. The original stream is the stream that "goes to the wire" (output stream for response from the underlying server container).
  • 服务端写拦截器:包装原始输出流为新的Gzip输出流。输出流来自上一步的服务端容器。
  • Server MessageBodyWriter: message body writer is executed on the server which serializes the entity into the GZIPOutputStream. This stream compresses the data and writes it to the original stream which sends this compressed data back to the client.
  • 服务端写消息体:写消息体序列化实体至Gzip输出流。它压缩数据并且把它写入院士刘发送这些压缩数据返回给客户端。
  • Client receives the response: the response contains compressed entity data.
  • 客户端接收响应:响应中包含被压缩的实体数据。
  • Client ClientResponseFilters: client response filters are executed and they manipulate the response headers.
  • 客户端响应过滤器:客户端响应过滤器操作响应头信息。
  • Client response is returned: the javax.ws.rs.core.Response is returned from the request invocation.
  • 客户端响应返回:从请求的等待中返回响应
  • Client code calls response.readEntity(): read entity is executed on the client to extract the entity from the response.
  • 客户端代码调用方法readEntity():在客户端执行从响应中获得实体
  • Client ReaderInterceptor: the client reader interceptor is executed when readEntity(Class) is called. The interceptor wraps the entity input stream with GZIPInputStream. This will decompress the data from the original input stream.
  • 客户端读拦截器:当readEntity被调用的时候,读拦截器执行。它用Gzip输入流包装实体输入流。这将从原始输入流中解压数据。
  • Client MessageBodyReaders: client message body reader is invoked which reads decompressed data from GZIPInputStream and deserializes the entity.
  • 客户端读消息体:当从Gzip输入流读解压数据并且反序列化实体的时候客户端读消息体被调用。
  • Client: The entity is returned from the readEntity().客户端实体信息从readEntity()中返回。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!
提供的源码资源涵盖了小程序应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值