I have a mobile webapp with a single view index.xhtml. I change this view dynamicaly with POST request only. Basically all my ViewScopedBean are SessionScopedBean. I don't know if it is the best solution for mobile webapp but there it is (dynamic updating looks like faster than reload a whole new page).
All is fine on localhost, even in production when I use the ip of my remote server to acces the mobile webapp. When I use the domain name, on one on my dynamic views, if do something with a post request, I got this exception
javax.faces.application.ViewExpiredException: viewId:/index2.xhtml - View /index2.xhtml could not be restored.
I know why this exception occurs but I don't why my view expired. Where should I look ? I could post my code but it's really messy.
Well I found the solution, I'm not sure why it happen.
In my bugged dynamic view I have a
url(#{prom.imageUrl})in some css. In my case#{prom.imageUrl}returns something like 167.xxx.xxx.xxx:8080/User/images/image.jpg. So here the thing, I have a apache server on port 80 who redirects the adress domain.com to 167.xxx.xxx.xxx:8080/User/. When I go on this dynamic view via 167.xxx.xxx.xxx:8080/User all is fine but if I access the view via domain.com , my session is reset ! My guess is calling this#{prom.imageUrl}call a connexion to 167.xxx.xxx.xxx:8080/User/ and since the server think it's a first connexion (cause I am connected via domain.com), he create a new session and then I got the viewexpired exception. But all of this need to be confirmed.