15. responsibility chain mode in Javascript design mode -- chain of responsibility

Source: Internet
Author: User
15. responsibility chain mode of JavaScript design mode ---- chain of responsibility
  •  

    Concept of responsibility chain model

    The responsibility chain mode is generally defined as follows: Multiple objects have the opportunity to process requests, so as to avoid coupling between request senders and receivers, that is, connect these objects into one (processing) chain and pass the request along the chain until the end of the chain has an object to process it.

    The most typical application of the responsibility chain mode is the Web. xml filter in the javaee specification. The filters process the mapping conditions in sequence according to the configuration order.
    The filtered Web Request/response can implement many "Responsibilities" such as encoding conversion, transaction encapsulation, and page cache ".

    Applicability of the responsibility chain model:

    1. There are multiple objects that can process a request, and the object that processes the request is automatically determined at the runtime. 2. If you want to submit a request to one of multiple objects without specifying the receiver explicitly. 3. The object set that can process a request must be dynamically specified.

    The sample code for this design pattern is not provided here...

    For more information about this design model, if you need it, remember "Baidu" Oh O (Baidu _ Baidu) O ~

     

    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.