Skip to main content


Showing posts from November, 2009

Chain of responsibility pattern meets Spring, JPA, Wicket and Apache CXF part 1/2

Chain of responsibility behavioral design pattern is a wonderful solution for complex logic of processing a requests. In this pattern single request (message, database record, external system call, etc.) is being passed to the first handler in the chain. This handler can:

process request and return resultprocess request partially and run subsequent handlerignore the request and pass the control further as aboverun next handler and, after it returns, process already handled requestsimply return, without processing and passing control down the chainthrow an exception
Of course, if the first handler decides to pass control down the chain to the second one, the second handler has the same set of options. The most important feature of handlers is that each handler is only aware of itself – it does not know its position in chain (whether it is first, last or somewhere in the middle) and particularly not know what is the next handler down the chain. Because each handler is available only throu…