什么是异步支持在web.xml中的目的是什么? [英] What's the purpose of async-supported in web.xml?

查看:295
本文介绍了什么是异步支持在web.xml中的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<servlet>
        <description>xxx</description>
        <servlet-name>xxx</servlet-name>
        <servlet-class>com.xxx.yyy</servlet-class>
        <async-supported>true</async-supported>
</servlet>

什么是的目的异步支持 servlet的web.xml配置文件中?什么情况下,我可以使用它?

What's the purpose of async-supported in the servlet's web.xml configuration file? What case I can use it in?

推荐答案

讽刺的是,我一直在寻找如何写在Tomcat中的web.xml这个属性的语法,这是我从谷歌开设了第一家搜索项目 - 这是写正确的太(它的工作原理),这样的感谢。

Ironically, I was looking for the syntax of how to write this property in tomcat's web.xml and this is the first search item I opened from google - it's written correctly too (it works), so thanks.

要虽然回答你的问题,这使servlet来存储供以后响应传入的请求。它释放了用于处理请求的线程,因此它可以用在别处,直到服务器准备发送的响应。

To answer your question though, this allows the servlet to store incoming requests for later response. It frees up the thread used to handle the request so it can be used elsewhere until the server is ready to send the response.

出于实用的目的,这种配置可以建立一个servlet即会(实际上) 按< /强> 数据到客户端(客户端向服务器发送初始请求之后)。

For practical purposes, with this configuration you can set-up a servlet that will (in effect) push data to the client (after the client sends the initial request to the server).

此技术代替了需要从客户端不必要定时请求以获得可在不确定的时间间隔改变的数据。它由不挂到线程执行它在一个可扩展的方式。

This technique replaces the need for unnecessary timed requests from a client to get data that can change at uncertain intervals. And it does it in a scalable manner by not hanging onto the thread.

一些例如用例包括:

聊天应用中,当一个客户端类型,您希望它立即出现在其他客户端的消息。

Chat applications, when one client types a message you want it to appear instantly to the other client.

电子邮件应用程序,以允许客户端只要它们是由电子邮件服务器接收查看电子邮件。

Email apps, to allow clients to view e-mails as soon as they are received by the e-mail server.

我也用它来从编程逻辑控制器发送输入变化更新浏览器的自动化任务。

I've also used it to send input change updates to a browser from a Programming Logic Controller for automation tasks.

<一个href=\"http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/async-servlet/async-servlets.html\">Here's它一个很好的教程。 <一href=\"http://stackoverflow.com/questions/12085235/servlet-3-async-context-how-to-do-asynchronous-writes\">This还介绍了一些螺母和螺栓在java中。

Here's a good tutorial on it. This also covers some nut and bolts in java.

这篇关于什么是异步支持在web.xml中的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆