Does Servlet return response after doGet method has finished?

前端 未结 2 740
暖寄归人
暖寄归人 2021-01-20 02:16

Obviously, the doGet method has a return type of void, so, it doesn\'t return anything. In this sense, I\'m using the word \"return\" to mean send the response

2条回答
  •  悲&欢浪女
    2021-01-20 02:28

    Yes, the response stream is flushed and closed when doGet() finishes executing.

    Keeping UI threads occupied for extended periods of time violates Java Enterprise best practice.

    Recommend you rather return immediately if nothing to respond, and implement a timer on the client (browser) side to poll the server for results every so often.

提交回复
热议问题