Showing posts with label Liferay Configuration. Show all posts
Showing posts with label Liferay Configuration. Show all posts

Thursday, March 20, 2014

Not getting parameters in controller class in Liferay 6.2 (Namespaced Parameters)


Starting from Liferay 6.2 only allows namespaced parameters. If we want to send unnamespaced parameters we need to turn the filter off. To achieve the same we need to add the following property in portlet's liferay-portlet.xml file.


<requires-namespaced-parameters>false</requires-namespaced-parameters>

Thursday, December 26, 2013

Friday, November 29, 2013

Kaleo Workflow Configuration for Custom Portlet in Liferay 6.1

1. Make sure you have deployed kaleo workflow war in your liferay portal.

2. Create the service.xml


3. Build the service

4. Edit the FeedbackLocalServiceImpl class and add the following methods:



5. Make the following entries in liferay-portlet.xml file



6. create the FeedbackAssetRendererFactory class



7. create the FeedbackAssetRenderer class-



8. create the /html/feedback.jsp file.


9. create the FeedbackWorkflowHandler class -



10. We are done with all the changes now, to see our portlet in action go to control panel → Workflow Configuration and set the workflow for your custom portlet.

Tuesday, November 19, 2013

Hiding SessionErrors Default Error Message

Whenever we make use of SessionErrors to display error message in Liferay, below default error message is also displayed by Liferay.



To get rid of this default message use the below code snippet -

NOTE: This will work for specific portlet only.

Monday, November 18, 2013

Adding Success Message in Liferay Custom Portlet Configuration Page

To add success message and page refresh in configuration page, just add the following snippet in your ConfigurationImpl class's processAction method ..


Configure Solr With Liferay 6

Configuring solr on standalone tomcat-

1. download solr and unzip to any directory say d:
2. set environment variable SOLR_HOME as D:\apache-solr-1.4.1\example\solr
3. Copy D:\apache-solr-1.4.1\dist\apache-solr-1.4.1.war and paste it in \Tomcat 6.0\webapps folder. make sure rename the war file to solr.war.
4. start the tomcat to unzip the war.
5. stop tomcat
6. edit the file \Tomcat 6.0\webapps\solr\WEB-INF\web.xml. Uncomment the following entry and provide path of your SOLR_HOME

7. Start tomcat and browse http://localhost:8080/solr/admin to verify your solr installation.

Configuring Solr plugin in Liferay-

1. download the required solr-web.war compatible with your liferay version
2. put this war in LIFERAY_HOME\deploy folder
3. After deployment shut down the Liferay server as well as solr instance.
4. Edit the file D:\liferay-portal-6.1.20-ee-ga2\tomcat-7.0.27\webapps\solr-web\WEB-INF\classes\META-INF\solr-spring.xml

provide your solr instance settings as above.
5. Copy D:\liferay-portal-6.1.20-ee-ga2\tomcat-7.0.27\webapps\solr-web\WEB-INF\conf\schema.xml file and paste it into D:\apache-solr-1.4.1\example\solr\conf folder.

Now start your tomcat and then Liferay server.

Sunday, September 1, 2013

Liferay Permission on Custom Portlet

As mentioned on Liferay Dcoumentation we can add permissions to your custom portlets using four easy steps (also known as DRAC):

1. Define all resources and their permissions.
2. Register all defined resources in the permissions system. This is also known as adding resources.
3. Associate the necessary permissions with resources.
4. Check permission before returning resources.

Here we are implementing Liferay Permission for custom portlet named StudentMaster.

1. The first step is to define your resources and the actions that can be defined on them. Create a file named default.xml in /src/resource-actions folder -


2. After defining resource permissions for our custom portlet, we need to refer Liferay to the resource-actions XML file that contains definitions. Create a properties file named portlet.properties that references the the file default.xml. In this portlet properties file, create a property named resource.actions.configs with the relative path to portlet’s resource-action mapping file (e.g.default.xml) as its value. Here’s what this property specification might look like:


3. Adding a Resource

After defining resources and actions, it’s time to add resources into the permissions system. Resources are added at the same time entities are added to the database. Each Entity that requires access permission must be added as a resource every time it is stored.

4. Adding Permission:

On the portlet level, no code needs to be written in order to have the permission system work for custom portlet. If we have defined any custom permissions (supported actions) in configuration file’s portlet-resource tag, they’re automatically added to a list of permissions in Liferay’s permissions UI. What good, however, are permissions that are available but can’t be set by users?
To let a user set permissions on model resources, we must expose the permission interface to the user. Just add these two Liferay UI tags to JSP:
1. : Returns a URL to the permission settings configuration page.
2. : Shows an icon to the user. These are defined in the theme, and one of them (see below) is used for permissions.

5. Checking Permission:


Friday, June 15, 2012

Liferay Ehcache Configuration : Distributed Caching in Liferay

Liferay Portal uses Ehcache to support distributed caching.


1. Enable distributed caching

To enable the distributed caching in liferay portal just set the following property in the portal-ext.properties file.

cluster.link.enabled=true

2. Default Hibernate cache settings

In Liferay Portal, hibernate is configured to use the Ehcache and default caching configurations are specified in the hibernate-clustered.xml file.

Following configuration is used by default for all the Liferay entities.



3. Customizing Hibernate Cache Settings

Let say we want to customize the hibernate cache settings for MBMessage Entity. Following are the steps to achieve our goal -

create a new folder say myEhcache in the [Tomcat Home]/webapps/ROOT /WEB-INF/classes/ folder and copy the default hibernate-clustered.xml file in the myEhcache folder.

Edit the hibernate-clustered.xml file and an entry for MBMessage Entity



4. Add an entry to portal-ext.properties file to provide the path of your custom hibernate-clustered.xml file

    net.sf.ehcache.configurationResourceName=/myEhcache/hibernate-clustered.xml

Restart the server.

5. Viewing Cache Configuration in jconsole -

jconsole can be used to view the current cache settings applied. Following is screenshot displaying the cache configuration for MBMessageImpl class:


As we customized the Hibernate cache settings, Cache settings for the clustered environment can also be configured via following files -

1.  liferay-single-vm.xml

2. liferay-multi-vm-clustered.xml