One approach here is to take into account the four most common HTTP methods and implement this functionality in a base class. For example, if we were to implement this in Python, we might implement a base class that define these methods. But these methods may be abstract, not intended to actually do anything.
In this case, other resources in your system would inherit from Resource and define the behavior of these methods. The key idea here being that you are building a resource oriented architecture at a level of abstraction that is not concerned with the web at all. This is powerful because it lets the developer shift the application code from framework to framework.
def get(self, *args, **kw):
def put(self, *args, **kw):
def post(self, *args, **kw):
def delete(self, *args, **kw):
The actual code that deals with web requests is simple. It says "I got a GET request for this resource. Application, what should I tell the client?". And the application can easily respond in a way that makes sense to the framework. Not only that framework, but possibly others as well.