自动会话超时在 Web 应用程序中(Angular 8 和 Rest API)在 4 分钟后发生。

huangapple 未分类评论47阅读模式
英文:

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) => {

我的问题:

  1. 这个超时是从 Angular 方面还是 Rest API 方面发生的?
  2. 我该如何处理它?

在 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) =&gt; {

My questions:

  1. Is this timeout happening from the angular side or restapi side?
  2. How can I handle it?

In Rest api web.xml, I have below entry:

&lt;session-config&gt;
	&lt;session-timeout&gt;60&lt;/session-timeout&gt;
&lt;/session-config&gt;

Please help for the same.

huangapple
  • 本文由 发表于 2020年5月4日 14:25:14
  • 转载请务必保留本文链接:https://java.coder-hub.com/61586310.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定