Approach 1: Replace the entire CMS with your own custom version of the servlet
This document does not describe how to create a servlet, resources on the web might help you.