Perheaps you could just join this statement with the one above ? .put(path).withHeader(etc).