Is there a way to convert the session object in scala to the session object in java in Play?
I have a Model method written in java like :
public void DoSomething(Request request, Session session)
{
String fancyValue = request.getQueryString("userInput");
session.put("Some Fancy Stuff",fancyValue);
}
and a Controller method written in scala like:
def showHomePage = Action { implicit request =>
val JRequest = play.core.j.JavaHelpers.createJavaRequest(request)
val JSession // conversion needed from request.session to play.mvc.Http.Session
new SomeModel().DoSomething(JRequest,JSession)
// would this include the updates done to the session in the java model?
Ok("Testing Stuff").withSession(session)
}
Ok("Testing Stuff").withSession(/* updated session*/), if you want to persist the session in the client? (Probably not a good idea to save too much data in the session cookie, rather use a handle to server-side cache).