Refactoring API service/servlet handling