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
RE: Meaning of mvc.path=- in PortletToolbarContributor
Hi All,
I was going through PortletToolbarContributor example in github. Below is the link
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
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.
Hi Minhchau,
Thanks for your in detailed inputs.
Regards
Hamidul Islam