Refactor and clean up EndpointFrameworkServlet.