updated request helper to additionally support JavaType as the return type.