Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Behavior with trailing slash
I have a question regarding trailing slashes in my app URL.
Basically my application is reachable at http://domain:8080/AppName
Now, if i refresh the page when it's pointed to that address, it just loads a new servlet (i can check it cos the main application calls init()) while, if i add a trailing slash (http://domain:8080/AppName/) it still uses the old servlet.
Is there something wrong in my web.xml file?
Edit.: I'm using tomcat 7.0
This is most likely caused by the servlet container setting the session cookie for the path /AppName/. This causes no cookie to be sent by the browser when requesting /AppName without the trailing slash which in turn causes a new session to be initialized and thereby Vaadin also creates a new Application instance.
Some servlet containers work this way because some browsers would send the same session cookie with requests to /AppName2 if it wasn't for the trailing slash. See e.g. the Tomcat's documentation for sessionCookiePathUsesTrailingSlash.
I fixed it simply by redirecting the users to an url which always contains the trailing slash.... It looks like it's working now!
Will check if the Tomcat sessionCookiePathUsesTrailingSlash works the same, but i'm pretty satisfied with my workaround for the moment!
Hey I know its been a while since you did this, but I am running into the same issue. I was hoping you could put the steps as to how you did the redirect. I have the same environment as you.
Vaadin running on Tomcat, and the "/" after AppName breaks stuff, but without it it reloads everytime
Edit: New to the whole web development thing, been a few months but now getting the hang of all the different parts slowly
Here is how I did the redirect
Just implement HttpServletRequestListener in your Application class, then in the onRequestStart() method do something like:
if(!request.getRequestURL().toString().contains("webapp/") // probably better to use a regex or something here but i am feeling lazy for now
response.sendRedirect(request.getRequestURL().toString() + "/");
when accesing application url from different browsers at same time and doing some transcations when we try to save the transcation at same time then second person values are updating in my transcation where the ui is same and how to solve this problem plz help me