[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jersey-dev] question about jax-rs client and session cookies
|
Hello, I am having trouble determining why I can't get a session
cookie from my test server.
I am performing the request like this:
Invocation.Builder invocationBuilder =
loginAction.request();
Response response =
invocationBuilder.post(Entity.form(form));
//System.err.println(response.readEntity(String.class));
session =
response.getCookies().get(SERVICE_SESSION_COOKIE_NAME);
This works as expected on a production (https) machine.
On my test (localhost, non-https), however, there is no cookie.
But I can check with wget or a browser and see that a cookie is
being sent to clients:
wget --keep-session-cookies --save-cookies /tmp/cookies.txt -S http://localhost:8080/hiwish/
--2020-05-07 16:12:43-- http://localhost:8080/app/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200
Set-Cookie: JSESSIONID=837D220DC49BD43242A3C13B0662FFD6; Path=/app; Secure; HttpOnly
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 07 May 2020 23:12:43 GMT
Length: unspecified [text/html]
Saving to: ‘index.html’
index.html [ <=> ] 19.12K --.-KB/s in 0s
2020-05-07 16:12:43 (46.9 MB/s) - ‘index.html’ saved [19574]
guymac@kal-el:~/winhome$ cat /tmp/cookies.txt
# HTTP cookie file.
# Generated by Wget on 2020-05-07 16:12:43.
# Edit at your own risk.
localhost:8080 FALSE /app TRUE 0 JSESSIONID 837D220DC49BD43242A3C13B0662FFD6