Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Interceptor pattern

From Wikipedia, the free encyclopedia
Example of an interceptor

In the field ofsoftware development, aninterceptor pattern is asoftware design pattern that is used when software systems orframeworks want to offer a way to change, or augment, their usual processing cycle. For example, a (simplified) typical processing sequence for a web-server is to receive a URI from the browser, map it to a file on disk, open the file and send its contents to the browser. Any of these steps could be replaced or changed, e.g. by replacing the way URIs are mapped to filenames, or by inserting a new step which processes the files contents.

Key aspects of the pattern are that the change istransparent and usedautomatically. In essence, the rest of the system does not have to know something has been added or changed and can keep working as before. To facilitate this, apredefined interface for extension has to be implemented, some kind ofdispatching mechanism is required where interceptors are registered (this may be dynamic, at runtime, or static, e.g. through configuration files) andcontext objects are provided, which allow access to the framework's internal state.[1]

Uses and context

[edit]

Typical users of this pattern are web-servers[2] (as mentioned above), object-[3] andmessage-oriented middleware[4]

An example of implementation of this pattern is thejavax.servlet.Filter interface, which is part ofJava Platform, Enterprise Edition.

Aspect-oriented programming (AOP) can also be used in some situations to provide the capability of an interceptor, although AOP doesn't use the elements typically defined[clarification needed] for the interceptor pattern.

References

[edit]
  1. ^"Schmidt, Stal, Rohnert & Buschmann: "Pattern-Oriented Software Architecture Vol.2: Patterns for Concurrent and Networked Objects", pp. 109--140, April 2001". Archived fromthe original on 2017-12-23. Retrieved2009-11-24.
  2. ^Apache Software Foundation: Tomcat 6.0 Channel Interceptor Reference, accessed 2009-Nov-24
  3. ^OMG, "CORBA v3.1, Part I: Interfaces", Chapter 16 "Portable Interceptors", January 2008
  4. ^"E. Curry, D. Chambers, and G. Lyons, "Extending Message-Oriented Middleware using Interception", presented at Third International Workshop on Distributed Event-Based Systems (DEBS '04), ICSE '04, Edinburgh, Scotland, UK, 2004"(PDF). Archived fromthe original(PDF) on 2011-07-26. Retrieved2009-11-24.
Gang of Four
patterns
Creational
Structural
Behavioral
Concurrency
patterns
Architectural
patterns
Other
patterns
Books
People
Communities
See also
Retrieved from "https://en.wikipedia.org/w/index.php?title=Interceptor_pattern&oldid=1146927247"
Categories:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp