I am confused between chain of responsibility and decorator pattern in cases when intermediate receivers in chain of responsibililty may also handle the request.(Like in case of servlet filters).
In Chain of Responsibility pattern, receivers are chained and pass any request messages from object to object until it reaches an object capable of handling the message. The intermediate objects "may" (or may not) handle the request message and modify it and pass it on. In decorator, each decorator object will add additional functionality (handle) and pass it on to the next object.
Is the only difference a "safety net" in case of Chain of Responsibility to "catch" any requests which go unhandled.
So how do we differentiate looking at the code, which pattern is being used.
Please correct me if I am wrong in my understanding.
TIA,
- Tinu