简体   繁体   中英

Servlet 3, <async-supported>true</async-supported> in web.xml vs asyncSupported=false

In my application

web.xml contains

<servlet>
    <servlet-name>PurchaseServlet</servlet-name>
    <servlet-class>org.codecypher.PurchaseServlet</servlet-class>
    <async-supported>true</async-supported>
</servlet>

And in main servlet class

@WebServlet(name="PurchaseServlet", urlPatterns={"/PurchaseServlet"},asyncSupported=false)

I am not able to identify type of servlet after deployment, whether is it Sync/Async?

If async requests are enabled for a Servlet, then ServletRequest.isAsyncSupported() will return true for requests sent to this Servlet.

If you configure a servlet via annotation and via web.xml using the same servlet name then the web.xml will override annotation values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM