Updated factory API to allow request-based handler creation