add resource request handler. fix #21