세션 개체를 스칼라로 변환하여의 에있는 세션 개체로 변환 할 수 있습니까?을 재생 하시겠습니까? 스칼라 세션 개체를 Play Framework의 Java 세션 개체로 변환
은 내가Model method
같이
java
에 기록이 있습니다
public void DoSomething(Request request, Session session)
{
String fancyValue = request.getQueryString("userInput");
session.put("Some Fancy Stuff",fancyValue);
}
과 Controller
방법은 같은 scala
작성 :
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)
}
클라이언트에서 세션을 유지하려면 [확인 (Stuff)]. withSession (/ * updated session * /)'이 아니어야합니까? (아마도 세션 쿠키에 너무 많은 데이터를 저장하는 대신 서버 측 캐시에 대한 핸들을 사용하는 것이 좋습니다.) –
@RichardClose 나는 다른 것에 초점을 맞추고 있었고 그것을 잊어 버렸고, 편집하고 그 세부 사항을 포함 할 것이고, 간단한 ID만을 저장할 수있는 세션을 사용하고있다. 그래서 그것을 채워 넣을 기회가 없다. 고마워. – somedev