开发者

how to use Httpsession in REST web service?

how to use HttpSession in Rest web service to save to login username? And how to pass session to another web service class or other cl开发者_如何学Cass?

thanks


REST services, by definition, are not supposed to have session state.

Create an 'authenticate' method which takes credentials and returns a 'token'. Then all other service methods should take this token as one of it's parameters and validate that it's good and not expired.

Check out OAuth as an industry standard protocol for doing this. There are a number of 3rd party libraries for both publishing and consuming OAuth services.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜