Interface FriendlyURLMapper
- All Known Implementing Classes:
BaseFriendlyURLMapper,DefaultFriendlyURLMapper
Never implement this interface directly, subclass BaseFriendlyURLMapper to ensure forward compatibility.
- Author:
- Brian Myunghun Kim, Brian Wing Shun Chan, Jorge Ferrer
- See Also:
-
BaseFriendlyURLMapperDefaultFriendlyURLMappercom.liferay.portlet.PortletURLImpl
-
Method Summary
Modifier and TypeMethodDescriptionbuildPath(LiferayPortletURL liferayPortletURL) Generates a friendly URL path from the portlet URL object.Returns the friendly URL mapping for this portlet.Returns the ID of this portletReturns the router for this friendly URL mapperbooleanReturnstrueif the friendly URLs for this mapper should include the friendly URL separator.booleanReturnstrueif this portlet is instanceable.voidpopulateParams(String friendlyURLPath, Map<String, String[]> parameterMap, Map<String, Object> requestContext) Populates the parameter map with values parsed from the friendly URL path.voidsetMapping(String mapping) Sets the friendly URL mapping for this portlet.voidsetPortletId(String portletId) Sets the ID of this portlet.voidsetPortletInstanceable(boolean portletInstanceable) Sets whether this portlet is instanceable.voidSets the router for this friendly URL mapper.
-
Method Details
-
buildPath
Generates a friendly URL path from the portlet URL object.- Parameters:
liferayPortletURL- the portlet URL object to generate a friendly URL for- Returns:
- the generated friendly URL, or
nullif one cannot be built. Returningnullwill cause a normal portlet URL to be generated.
-
getMapping
String getMapping()Returns the friendly URL mapping for this portlet.The friendly URL mapping is used by Liferay to identify the portlet a friendly URL refers to. It generally appears directly after the
/-/in the URL.For instance, the blogs portlet mapping is "blogs". This produces friendly URLs similar to
http://www.liferay.com/web/guest/blog/-/blogs/example-post- Returns:
- the friendly URL mapping for this portlet, not including any leading or trailing slashes
-
getPortletId
String getPortletId()Returns the ID of this portlet- Returns:
- the ID of this portlet, not including the instance ID
-
getRouter
Router getRouter()Returns the router for this friendly URL mapper- Returns:
- the router, or
nullif one has not been set
-
isCheckMappingWithPrefix
boolean isCheckMappingWithPrefix()Returnstrueif the friendly URLs for this mapper should include the friendly URL separator.Typically, friendly URLs will include the separator "/-/" before the friendly URL mapping. If this method returns
false, a single slash will be used instead.This method is called by
PortalImplwhen a friendly URL is processed.It is strongly recommended that this method always return
true.- Returns:
trueif the "/-/" separator should be included in friendly URLs, orfalseif only a "/" should be used
-
isPortletInstanceable
boolean isPortletInstanceable()Returnstrueif this portlet is instanceable.The value returned from this method has no effect on whether a portlet is instanceable, it is a helper method used to determine if the instance ID should be included in the URL.
- Returns:
trueif the portlet is instanceable;falseotherwise
-
populateParams
void populateParams(String friendlyURLPath, Map<String, String[]> parameterMap, Map<String, Object> requestContext) Populates the parameter map with values parsed from the friendly URL path.This method is called by
PortalImplwhen a friendly URL is processed.- Parameters:
friendlyURLPath- the friendly URL path, including a leading slash and the friendly URL mapping. For example:/blogs/example-postparameterMap- the parameter map. Entries added to this map must be namespaced.requestContext- the request context- See Also:
-
setMapping
Sets the friendly URL mapping for this portlet.This method is automatically called by
PortletBagFactorywith the friendly URL mapping defined inliferay-portlet.xml.- Parameters:
mapping- the friendly URL mapping for this portlet
-
setPortletId
Sets the ID of this portlet.This method is automatically called by
PortletBagFactorywith the portlet ID defined inliferay-portlet.xml.- Parameters:
portletId- the ID of this portlet.
-
setPortletInstanceable
void setPortletInstanceable(boolean portletInstanceable) Sets whether this portlet is instanceable.- Parameters:
portletInstanceable- whether this portlet is instanceable
-
setRouter
Sets the router for this friendly URL mapper.This method is automatically called by
PortletBagFactorywith a router populated with the routes defined in this portlet's friendly-url-routes.xml file. The location of this file is defined in this portlet's liferay-portlet.xml file.- Parameters:
router- the router for this friendly URL mapper
-