Is there a way to use addRequestProperty if you have already connected to the URLConnection? I 开发者_如何学JAVAneed to do this cause I first have to connect to get the headerfields for the first Cookie, but later I have to send that first Cookie in order to get headerfields where a second set-cookie field is defined.
That won't work. The HTTP protocol conveys those properties as header items at the beginning of the request data. You'll need multiple requests.
精彩评论