Android WebView can ' t get session when using target= "_blank" with <a> link.
# # # Version 3.5.1 (maybe 3.5.0 included,not sure)
* Vert.x Core:
* Vert.x Web:
# # Context
I used Android WebView to call a vertx url,when I switched from one page to another, the VERTX server would always Generat e A new session ID, so I lost session data set by previous page.
But,when I use iphone webview or PC Chrome to call the same VERTX server, the session can be remembered correctly. So the error was only subject to Android WebView
# # # Does you have a reproducer?
We can reproducer the error following the steps below.
# # Steps to Reproduce
1. Write a smiple verticle
Public class test1verticle extends abstractverticle { router router1 ; @Override public void start () throws exception { router1 = router.router (VERTX); router1.route (). Handler (Cookiehandler.create ()); router1.route (). Handler ( Sessionhandler.create (Localsessionstore.create (VERTX))) router1.route ("/h5/*"). Handler (Statichandler.create ("Web/h5")); router1.route ("/hit"). Handler (This::hit); vertx.createhttpserver (). RequestHandler (Router1::accept). Listen (8080) ; } private void hit (Routingcontext routingcontext) { session session = routingcontext.session (); integer cnt = session.get ("Hitcount"); cnt = (cnt == null ? 0 : cnt) + 1; session.put ("Hitcount", cnt); routingcontext.response (). Putheader ("Content-type", "Application/json;charset=utf-8") .end (New jsonobject (). Put ("Data", "cnt=" +cnt) ) ; } }
2. Place 2 HTML files in the Web/h5 file folder,named test3.html and test4.html respectively. test3.html Source C Ode:
The source code of test4.html is similar to the Above,just replace the href to test3.html
3 .....
Start the Vertx verticle, and open an Android browser,input the URL (http://192.168.0.13:8080/h5/test3.html) in the Browse R,then Submit
4. You can-find, after-jump-to-the-other html,the hits count remains to 1, and if you call the URL in the iphone or PC browser The hit count would be found to increment correctly.
5,if We remove the target= "_blank" in the HTML file, the session would work properly
Android WebView can ' t get vertx session