Posts

Showing posts from April, 2015

Extending the session/jsessionId

Image
JSESSIONID is a cookie generated by Servlet container like Tomcat or Jetty and used for session management in J2EE web application for http protocol.  Since HTTP is a stateless protocol there is no way for Web Server to relate two separate requests coming from same client and Session management is the process to track user session using different session management techniques like Cookies and URL Rewriting. If Web server is using cookie for session management it creates and sends JSESSIONID cookie to the client and than client sends it back to server in subsequent http requests. This cookie is valid still the browser session is available. We can view this JSessionId in the chrome as If we want this jsession cookie should  be present certain period of time. How can we do it? In liferay  it can be done just by adding the entry in the web.xml Go to the 1. <liferay-path>/tomcat/webapps/ROOT/WEB-INF/  2. Open the web.xml and add the "cookie-config" Full s

Retrieving/getting the JournalArticle from the Tag

Whenever we create the JournalArticle we add tag. Sometimes it is required to get the "Article" from the tag, so how can we do that. Here is the code, String tagName = "cricket"; AssetTag assetTag = AssetTagLocalServiceUtil.getTag(themeDisplay.getScopeGroupId(),tagName); AssetEntryQuery assetEntryQuery = new AssetEntryQuery(); assetEntryQuery.setAllTagIds(new long []{assetTag.getTagId()}); List<journalarticle> journalArticleList = null; List<assetentry> assetEntryList = AssetEntryLocalServiceUtil.getEntries(assetEntryQuery); for(AssetEntry assetEntry : assetEntryList) { try { JournalArticleResource journalArticleResource = JournalArticleResourceLocalServiceUtil .getJournalArticleResource(assetEntry .getClassPK()); JournalArticle journalArticle = JournalArticleLocalServiceUtil.getArticle(groupId,journalArticleResource.getArticleId()); jou