How would you implement an extendable web application? What I'm thinking about is a web application similar to Jenkins or Hudson which provides plug-in support. While it's obvious to me how plug-ins can be located and loaded, I don't know how they can be integrated within the overall architecture. I'm especially uncertain about the following points.
How can a plug-in change the view, e.g. add input elements to a form?
My first idea would be that a plug-in can register partials / fragments for a certain form.
Example: Newsletter plug-in which registers a typical newsletter checkbox fragment which will be rendered in the user registration view.
How can a plug-in react to incoming requests?
Again, a direct approach would be to provide listeners for certain requests or actions, e.g. POST request to /user.
How could a plug-in persist data?
I'm assuming this is a situation where NoSQL data storage solutions would be superior to relational databases.
I would appreciate any comments, ideas and experiences (maybe there is even a design pattern) that you have regarding extendable web applications.