|
Liferay 6.2-ce-ga5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.liferay.portal.kernel.portlet.BaseFriendlyURLMapper com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper
public class DefaultFriendlyURLMapper
The default friendly URL mapper to use with friendly URL routes.
In most cases, to add friendly URL mapping to a portlet, simply set this
class as the friendly URL mapper in liferay-portlet.xml
, and
write a friendly-url-routes.xml
file.
If you do need to extend this class, use AlloyFriendlyURLMapper
as a guide. The key
methods to override are buildPath(LiferayPortletURL)
and populateParams(String, Map, Map)
.
Router
Field Summary | |
---|---|
protected Set<String> |
defaultIgnoredParameters
|
protected Map<String,String> |
defaultReservedParameters
|
Fields inherited from class com.liferay.portal.kernel.portlet.BaseFriendlyURLMapper |
---|
router |
Constructor Summary | |
---|---|
DefaultFriendlyURLMapper()
|
Method Summary | |
---|---|
void |
addDefaultIgnoredParameter(String name)
Adds a default ignored parameter. |
void |
addDefaultReservedParameter(String name,
String value)
Adds a default reserved parameter. |
protected void |
addParametersIncludedInPath(LiferayPortletURL liferayPortletURL,
Map<String,String> routeParameters)
Adds the parameters included in the path to the portlet URL. |
String |
buildPath(LiferayPortletURL liferayPortletURL)
Generates a friendly URL path from the portlet URL object. |
protected void |
buildRouteParameters(LiferayPortletURL liferayPortletURL,
Map<String,String> routeParameters)
Builds the parameter map to be used by the router by copying parameters from the portlet URL. |
Set<String> |
getDefaultIgnoredParameters()
Returns the default ignored parameters. |
Map<String,String> |
getDefaultReservedParameters()
Returns the default reserved parameters. |
protected String |
getPortletId(Map<String,String> routeParameters)
Returns the portlet ID, including the instance ID if applicable, from the parameter map. |
protected void |
populateParams(Map<String,String[]> parameterMap,
String namespace,
Map<String,String> routeParameters)
Populates the parameter map using the parameters from the router and the default reserved parameters. |
void |
populateParams(String friendlyURLPath,
Map<String,String[]> parameterMap,
Map<String,Object> requestContext)
Populates the parameter map with values parsed from the friendly URL path. |
Methods inherited from class com.liferay.portal.kernel.portlet.BaseFriendlyURLMapper |
---|
addParam, addParam, addParameter, addParameter, addParameter, addParameter, addParameter, addParameter, getMapping, getNamespace, getPortletId, getRouter, isCheckMappingWithPrefix, isPortletInstanceable, setMapping, setPortletId, setPortletInstanceable, setRouter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Set<String> defaultIgnoredParameters
protected Map<String,String> defaultReservedParameters
Constructor Detail |
---|
public DefaultFriendlyURLMapper()
Method Detail |
---|
public void addDefaultIgnoredParameter(String name)
A default ignored parameter will always be hidden in friendly URLs.
name
- the name of the parameterpublic void addDefaultReservedParameter(String name, String value)
A default reserved parameter will be hidden in friendly URLs when it is set to its default value.
name
- the name of the parametervalue
- the default value of the parameterpublic String buildPath(LiferayPortletURL liferayPortletURL)
FriendlyURLMapper
liferayPortletURL
- the portlet URL object to generate a friendly
URL for
null
if one cannot be
built. Returning null
will cause a normal portlet
URL to be generated.public Set<String> getDefaultIgnoredParameters()
addDefaultIgnoredParameter(String)
public Map<String,String> getDefaultReservedParameters()
addDefaultReservedParameter(String, String)
public void populateParams(String friendlyURLPath, Map<String,String[]> parameterMap, Map<String,Object> requestContext)
FriendlyURLMapper
This method is called by PortalImpl
when
a friendly URL is processed.
friendlyURLPath
- the friendly URL path, including a leading slash
and the friendly URL mapping. For example:
/blogs/example-post
parameterMap
- the parameter map. Entries added to this map must be
namespaced.requestContext
- the request contextBaseFriendlyURLMapper.addParameter(Map, String, String)
,
BaseFriendlyURLMapper.addParameter(String, Map, String, String)
protected void addParametersIncludedInPath(LiferayPortletURL liferayPortletURL, Map<String,String> routeParameters)
Portlet URLs track which parameters are included in the friendly URL path. This method hides all the default ignored parameters, the parameters included in the path by the router, and the reserved parameters set to their defaults.
liferayPortletURL
- the portlet URL to which to add the parameters
included in the pathrouteParameters
- the parameter map populated by the routerPortletURLImpl.addParameterIncludedInPath(
String)
protected void buildRouteParameters(LiferayPortletURL liferayPortletURL, Map<String,String> routeParameters)
This method also populates the special virtual parameters
p_p_id
and instanceId
for instanceable
portlets.
liferayPortletURL
- the portlet URL to copy parameters fromrouteParameters
- the parameter map to populate for use by the
routerprotected String getPortletId(Map<String,String> routeParameters)
routeParameters
- the parameter map. For an instanceable portlet,
this must contain either p_p_id
or
instanceId
.
null
if it cannot be determinedprotected void populateParams(Map<String,String[]> parameterMap, String namespace, Map<String,String> routeParameters)
parameterMap
- the parameter map to populate. This should be the map
passed to populateParams(String, Map, Map)
by PortalImpl
.namespace
- the namespace to use for parameters added to
parameterMap
routeParameters
- the parameter map populated by the router
|
Liferay 6.2-ce-ga5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |