如何在DropWizard中维护用户会话? [英] How to maintain user sessions in DropWizard?
本文介绍了如何在DropWizard中维护用户会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一个持久的会话管理器,它将会话保存在可以与DropWizard一起使用的文件系统(如PHP)上。我看到有一个 Environment.getSessionHandler()
,但是我看不到任何文档。
I am looking for a persistent session manager which saves the session on file system (like PHP) that can be used with DropWizard. I see there is one Environment.getSessionHandler()
, but I see no documentation on it.
我可以写我自己的,但我希望能做一顿饭。上面的SessionHandler是我想要的吗?以及如何使用它?
I could write my own but I am hoping for a cooked meal. Will the above SessionHandler is what I am looking for? And how to use that?
推荐答案
使用dropwizard> 0.7
With dropwizard>0.7
environment.jersey().register(HttpSessionProvider.class);
environment.servlets().setSessionHandler(new SessionHandler());
然后在您的计算机中使用 @Session
批注资源类。
And then use @Session
annotation in your resource classes.
这篇关于如何在DropWizard中维护用户会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文