RE: Meaning of mvc.path=- in PortletToolbarContributor

thumbnail
Hamidul Islam, modified 7 Years ago. Regular Member Posts: 111 Join Date: 5/22/08 Recent Posts

Hi All,

I was going through PortletToolbarContributor example in github. Below is the link 

https://github.com/liferay/liferay-blade-samples/blob/7.0/gradle/extensions/portlet-toolbar-contributor/src/main/java/com/liferay/blade/samples/portlet/toolbar/contributor/BladePortletToolbarContributor.java

 

Here is the snippet 

 

@Component(
 immediate = true,
 property = {
 "javax.portlet.name=com_liferay_hello_world_web_portlet_HelloWorldPortlet",
 "mvc.path=-"
 },
 service = PortletToolbarContributor.class
 )

 

I just want to know whats meaning of mvc.path=- in the above code and why its necessary. 

 

Regards 

Hamidul Islam 

thumbnail
Minhchau Dang, modified 7 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Hamidul Islam:

I just want to know whats meaning of mvc.path=- in the above code and why its necessary. 

For your first question about the meaning of mvc.path, it boils down to a property that allows your PortletToolbarContributor to be found.

Your implementation of a PortletToolbarContributor will be found using a PortletToolbarContributorLocator. These are collected inside of PortletToolbar, and checked on each request. Liferay's default implementations of that interface extend BasePortletToolbarContributorLocator, which (as part of its component activation) looks things up using some property name that's defined in a child class. One of those child classes is MVCPortletToolbarContributorLocator, which defines its property name as mvc.path.

For your question as to why it's necessary, technically you don't need to set mvc.path as long as you set one of the properties that's used in any of the other PortletToolbarContributorLocator instances. However, you have to set at least one of the properties that's checked by a known PortletToolbarContributorLocator implementation, or your PortletToolbarContributor won't be found.

thumbnail
Hamidul Islam, modified 7 Years ago. Regular Member Posts: 111 Join Date: 5/22/08 Recent Posts

Hi Minhchau,

Thanks for your in detailed inputs.  

 

Regards

Hamidul Islam