Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to get session attribute from different RESt builder different APIs?
RAVI RAJAMANI, modificat fa 5 anys.
Regular Member
Apunts: 123
Data d'incorporació: 07/12/14
Publicacions recents
How to get session attributes from different modules , RESTbuilder API modules.
say Module1 and Module2
In Module1 i had saved session value like below
HttpSession httpSession = contextHttpServletRequest.getSession(true);
httpSession.setAttribute("fooKey", "fooValue");
In Module2 i had getting session value like below
HttpSession httpSession = contextHttpServletRequest.getSession(true);
String value = (String) httpSession.getAttribute("fooKey")
System.out.println(value); // null is coming
Getting null , cannot able to getAttribute from different module
David H Nebinger, modificat fa 5 anys.
Liferay Legend
Apunts: 14933
Data d'incorporació: 02/09/06
Publicacions recents
You should not do this. The APIs are intended to be stateless. They are not built to support maintaining state across calls.
RAVI RAJAMANI, modificat fa 5 anys.
Regular Member
Apunts: 123
Data d'incorporació: 07/12/14
Publicacions recents
David H Nebinger:
Is there any other way to achieve like this ?
You should not do this. The APIs are intended to be stateless. They are not built to support maintaining state across calls.
Christoph Rabel, modificat fa 5 anys.
Liferay Legend
Apunts: 1555
Data d'incorporació: 24/09/09
Publicacions recents
When you use rest calls, the application is usually the client and the application state is then held in the browser. The other option is to store only a key in the application and the rest of the information in the database.
Even if you find a momentary way around this, e.g. by using a cache or singleton + hash, believe me, it probably will bite you later on.
Even if you find a momentary way around this, e.g. by using a cache or singleton + hash, believe me, it probably will bite you later on.
Community
Company
Feedback