Report session and application session common sense popularization

Source: Internet
Author: User

1. Report session and application session

Report integration into a project there may be a question that system applications and reports are applied under a Web server, and that the session and report session are not a session? If not, will there be conflict?

is: not the same session will not conflict, because the application session is stored in request requests and other shared information, and the report session is stored in the report to access the relevant information, such as the access is not the same template, the two are completely independent, so there is no conflict.

2. Create and close session mechanism in Report development tool Finereport

Normally, when a client browser accesses a report on a report server side, a session is generated, which notifies the report server to close the session when the user closes the browser, but does not cause the session object to be saved on the server side to disappear. It also does not cause persistent cookies that have been saved to the hard disk to disappear.

If the user's machine for some reason, such as abnormal shutdown and so on, the browser is not properly shut down, the server did not receive the shutdown session information, will keep this unnecessary session. To solve this problem, our software provides a mechanism for the browser to send an "I am alive" message to the server every 40 seconds, and if the report server does not receive this message in a minute, it will automatically close the session. When the browser encounters an abnormal stop, the "I am Alive" message is not sent, and the corresponding session will not be closed within one minute.

3. Basic concept of the session

The session mechanism itself is not complex, but its implementation and configuration flexibility makes the specific situation complex and changeable. This also requires that we do not have a single experience or a particular browser, server experience as a universally applicable experience, but always need specific circumstances specific analysis.

The popular saying: The client browser accesses an address, sends a request, produces a session, now the browser can open more than one tab window, open all belong to a session, when the browser closed session closed. If you do not close the browser and open a browser again, a session will be recreated.

When the 3.1 session was created

A common misconception is that the session is created when there is client access, but the fact is that it is not created until a statement such as Httpservletrequest.getsession (true) is called by a server-side program, and note that if the JSP does not display the use <% @page session= "false"%> the session is closed, the JSP file is automatically translated into a servlet with such a statement httpsession session = Httpservletrequest.getsession (True), which is also the origin of the hidden session object in the JSP.

Because the session consumes memory resources, if you do not intend to use the session, you should close it in all JSPs.

When the 3.2 session is deleted

To synthesize the previous discussion, the session is removed in the following cases:

A, the program calls Httpsession.invalidate () b, the distance from the last time the client sent the session ID interval exceeds the session's maximum effective time C, the server process is stopped

3.3 How to delete a session when the browser is closed

Strictly speaking, do not do this. One way to do this is to use JavaScript code window.oncolose on all client pages to monitor the browser's closing action, and then send a request to the server to delete the session. But there is still nothing to do with the unconventional means of a browser crash or a forced kill process.

Report session and application session common sense popularization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.