So I'm trying build a Java web application on Google App Engine. One of the first things I started with is to let my JSP page detect the Locale of the HttpRequest and thus display the page in the correct language OR use the language that the user selected and was stored in a session variable.
I found this question and BalusC's answer works really well in my project (https://github.com/Leejjon/Blindpool) when running my application locally on Jetty (running it using 'mvn jetty:run-exploded'): How to internationalize a Java web application?
However, when I run it on a local app engine devserver using 'mvn appengine:devserver', it doesn't store the language in the variable. It doesn't work on the real app engine either.
Now I don't see any errors in the App Engine logging, and I don't seem to be able to debug the JSP page in App Engine like I can when running it locally (only .java files can be debugged on app engine).
According to the documentation GAE stores session variables in memcache and backs them up in the data store to be scalable. That would be fine if it works, but it doesn't.
So I'm probably going to write a Servlet version of this code and see if I can debug it.
My current JSP code:
<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%-- If the language is being passed in a parameter, use that language. --%>
<c:if test="${not empty param.language}">
<c:set var="language" value="${param.language}" scope="session" />
</c:if>
<%-- If the language variable isn't set at all, use the default locale from the request. --%>
<c:if test="${empty language}">
<c:set var="language" value="${pageContext.request.locale}" scope="session" />
</c:if>
<%-- Use the locale to set up the bundle. --%>
<fmt:setLocale value="${language}" />
<fmt:setBundle basename="net.leejjon.blindpool.i18n.messages" />
<!DOCTYPE html>
<html lang="${language}">
<head>
<title><fmt:message key="title" /></title>
</head>
<body>
<form>
<label><fmt:message key="language" /></label>
<select id="language" name="language" onchange="submit()">
<option value="en" ${language == 'en' ? 'selected' : ''}>English</option>
<option value="nl" ${language == 'nl' ? 'selected' : ''}>Nederlands</option>
</select>
</form>
</body>
</html>
TLDR - My question is: Is there a known problem with storing variables in sessions on Google App Engine and am I supposed to use other Google API's to work around this?