问题
So I am trying to add a cookie to a connection. In HTTPUrlConnection, I do the following:
HttpURLConnection con;
String cookieString = null;
con = ((HttpURLConnection) new URL(appUrl).openConnection());
String cookieString = formatCookies("session", userCredential);
con.setRequestProperty("Cookie", cookieString);
...
I want to do the same in Jersey. So far I have the following:
WebTarget wt = client.target(appUrl).path(path);
wt.queryParam(..., ...)
.request(...)
.cookie("session", userCredential)
.get(InputStream.class);
Is this the correct way to go about this?
来源:https://stackoverflow.com/questions/60512611/jersey-equivalent-to-httpurlconnection