Sometimes we have to know which liferay version we are using, so how can we know? We can know the liferay version in different ways. 1. Liferay has provided some utility methods to know the which liferay version we are using , Here is the utility method ReleaseInfo.getReleaseInfo() It prints this statement " Liferay Portal Community Edition 6.2 CE GA2 (Newton / Build 6201 / March 20, 2014) " as i am using community version it shoes as CE. 2. Also we can also identify by response headers as below screenshot. If your using the chrome, right click on the browser and click inscept element , and navigate to the network . you will see the URLS , click on the any url. 3. Also we can see during server startup as below statement Liferay Portal Community Edition 6.2 CE GA2 (Newton / Build 6201 / March 20, 2014)
In Liferay we can exceute the background task asynchrously. The Background Task framework allows the developers to create and manage any kind of tasks that need to be run in a separated thread without the need of knowing anything about JAVA threading or concurrency Here the code ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); Map taskContextMap = null; String taskName = null; String servletContextNames [] = new String[1] ; Portlet portlet = PortletLocalServiceUtil.getPortletById(request.getAttribute(WebKeys.PORTLET_ID).toString()); servletContextNames[0] = portlet.getContextName(); try { BackgroundTaskLocalServiceUtil.addBackgroundTask(themeDisplay.getUserId(), themeDisplay.getScopeGroupId(), taskName, servletContextNames,TestBackgroundTaskExecutor.class, taskContextMap,new ServiceContext()); } catch (PortalException e) { e.printStackTrace(); } catch (SystemException e) { e.printStackTrace(); } ...
In Liferay , you can encrypt and decrypt the senstive data. Liferay has provided easy way to encrypt the data. Have a look at the Encryptor class , we find the methods to encrypt and decrypt the data. Here is an example of encryption of data. private String encrptData(ActionRequest actionRequest,String data ) throws PortalException, SystemException, EncryptorException{ ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest. getAttribute(WebKeys.THEME_DISPLAY); Company company = CompanyLocalServiceUtil.getCompany(themeDisplay.getCompanyId()); Key key = company.getKeyObj(); return Encryptor.encrypt(key, data); } The same string we can decrypt the following line as , Encryptor.decrypt(key, data); So we may have an doubt which encryption algorithm liferay is using go to the portal.properties look at the following 2 properties. company.encryption.algorithm=DES ...
Comments
Post a Comment