Liferay Research 20: How to prevent continuous repeated submissions

Source: Internet
Author: User

The general solution to the continuous repetition of the submission of the following methods.

Method A, commit after the submit button is disabled (most people do this)
Method II, the use of Session, the second part of the token, set a value for the first time, after the request to the first and this token to compare;
Method three, data processing success immediately redirect to another page

Liferay in the foreground uses the client script (may be jquery, did not study carefully), the session, the backstage uses the synchronization, the multithreading and so on solves this question. Service-side solutions to the specific ideas are as follows:

A Doubleclickcontrolor instance is placed in the session, and the instance is synchronized to determine whether the request is repeated.
If you repeat the request, then determine which is the firstrequest, which is not, not the Doubleclickcontrolor instance as the synchronization basis, into a waiting state, until firstrequest execution, call the Notifyall method, Activates the second request.
In Doubleclickfilter, Controller.control (Httpreq, Httpres, chain); the second request will not end with any exceptions, which will execute OK = true; In turn, the console prints out information such as blocking a repeat submission.

In addition, the revision of a filterchain knowledge point.
When a request is made to the server, the filter mapping configuration is used to match which filter needs to be executed before accessing the requested resource. All of the filter forms a filterchain according to the order defined by Filter-mapping, which is called sequentially.

This call is somewhat similar to recursion, and when invoked to Chain.dofilter (), the program execution thread jumps to the next filter's Dofilter method until the last filter, The last filter executes chain.dofilter without performing an action, and does not jump to other filter Executes the code after the Chain.dofilter, exits the Dofilter method, and executes the code following the chain.dofilter of the penultimate filter, and so on.

In Liferay, you set which filter to turn on or off by System.properties.



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.