You need to add a callback in XWalkCordovaResourceClient.java named
onReceivedResponseHeaders
@Override
public void onReceivedResponseHeaders(XWalkView view,
XWalkWebResourceRequest request,
XWalkWebResourceResponse response) {
// TODO Auto-generated method stub
super.onReceivedResponseHeaders(view, request, response);
if(response.getStatusCode() == 200) {
Map<String, String> headers = response.getResponseHeaders();
String cookies = headers.get("Set-Cookie");
if(cookies != null) {
mTextView.setText(cookies);
}
}
}
Thanks,
Junwei.
From: Adrian Gillette [mailto:[email protected]]
Sent: Thursday, June 09, 2016 12:23 PM
To: [email protected]; Fu, Junwei
Subject: Re: [Crosswalk-help] HELP!!! - cannot set cookie
Junwei,
I see that there’s fix for cookies,
https://crosswalk-project.org/jira/browse/XWALK-4643.
As for me, I’ve modified my server side code to set the cookie in the response
header:
Set-Cookie:sessionId=6a83de6d3877c1e4f6a39961f06e00b5990c645a;
Domain=.mydomain.com; Path=/; Expires=Sat, 09 Jul 2016 04:19:47 GMT
But when I console out “document.cookie” in returns an empty string.
Do you have any suggestions on how I can get cookies working in my Cordova app?
Adrian
From: Crosswalk-help
<[email protected]<mailto:[email protected]>>
on behalf of Adrian Gillette <[email protected]<mailto:[email protected]>>
Date: Wednesday, June 8, 2016 at 5:14 PM
To:
<[email protected]<mailto:[email protected]>>
Subject: [Crosswalk-help] HELP!!! - cannot set cookie
Hi,
I’m using Crosswalk in my Cordova app. Crosswalk is preventing my app from
sending header cookies. Here’s the test code I’m using to send a custom header:
request.open('GET',’http://myurl.com<http://myurl.com/>’);
request.withCredentials = true;
request.setRequestHeader('Accept', 'application/json');
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Cookie', 'test=1234');
request.setRequestHeader('Test', 'test');
request.send();
Looking at the network log, I can see that everything accept the cookie was
sent. The console logged the following error:
Refused to set unsafe header "Cookie"
Please help me with this issue!!
Adrian
_______________________________________________ Crosswalk-help mailing list
[email protected]<mailto:[email protected]>
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help