英文:
Automatic session timeout in web application (Angular 8 and Rest API) after 4 minutes
问题
在我开发的 Angular 8 应用程序和 Rest API 中,有一个调用上传某些文档所需的时间比平常要长(> 10 分钟或更长)。
但是我可以在浏览器的网络中看到,经过 4 分钟后,我的请求会自动取消,在我的后端出现以下错误:
Servlet.service() 对于 servlet javax.ws.rs.core.Application 引发了异常:java.lang.IllegalStateException
在 Angular 中,我尝试了下面的代码,但没有成功,我在使用 post 终点:
this.httpClient.post(endpoint, formData, { params: payload }).pipe(timeout(36000000)).subscribe((response: boolean) => {
我的问题:
- 这个超时是从 Angular 方面还是 Rest API 方面发生的?
- 我该如何处理它?
在 Rest API 的 web.xml 中,我有以下条目:
<session-config>
<session-timeout>60</session-timeout>
</session-config>
请为此提供帮助。
英文:
In my application developed in angular 8 and Rest API, I have a call that takes a long time than usual (> 10 minutes or more) in uploading certain documents.
But I can see in my browser's network that after 4 minutes my request gets canceled automatically and in my backend below error comes:
Servlet.service() for servlet javax.ws.rs.core.Application threw exception: java.lang.IllegalSta
teException
In angular I tried below code but did'nt work out, I am using post end point:
this.httpClient.post(endpoint, formData, { params: payload }).pipe(timeout(36000000)).subscribe((response: boolean) => {
My questions:
- Is this timeout happening from the angular side or restapi side?
- How can I handle it?
In Rest api web.xml, I have below entry:
<session-config>
<session-timeout>60</session-timeout>
</session-config>
Please help for the same.
专注分享java语言的经验与见解,让所有开发者获益!
评论