0

I know it is possible to define the scope of the beans, but I am wondering is it possible to define the scope of the whole project? I have a Web Service project which only provides services to other projects and they form an application together. What I would like to do is configure the WS project so that it closes its connection with the client as soon as it responds to the client successfuly.

I have been looking all around but couldn't really find what I am looking for.I tried this:

<session-config>
        <session-timeout>60</session-timeout>       
</session-config>

but I don't want to set the session timeout to a set value, instead I would like to make it something like session, or request etc. Is this possible?

sticky_elbows
  • 1,344
  • 1
  • 16
  • 30

1 Answers1

1

After http1.1 all the connections are persistent connection. So http connection does not close after serving request. This approach was used to improve CPU time and network congestion. Please refer https://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html. Suggested approach is to have session time out with persistent connection.

Scopes in Spring MVC are for beans to my knowledge. You cannot change the scope of bean and expect the Connection to be closed. I have never tried to disable the persistent connections, but I found following article on web https://blog.stackpath.com/glossary/keep-alive/ . Hope this helps!!