Liferay 6.2-ce-ga5

com.liferay.portal.kernel.portlet
Class BaseFriendlyURLMapper

java.lang.Object
  extended by com.liferay.portal.kernel.portlet.BaseFriendlyURLMapper
All Implemented Interfaces:
FriendlyURLMapper
Direct Known Subclasses:
BaseFriendlyURLMapper, DefaultFriendlyURLMapper, TagsCompilerFriendlyURLMapper

public abstract class BaseFriendlyURLMapper
extends Object
implements FriendlyURLMapper

The base implementation of FriendlyURLMapper.

Typically not subclassed directly. DefaultFriendlyURLMapper and a friendly-url-routes.xml file will handle the needs of most portlets.

See Also:
DefaultFriendlyURLMapper

Field Summary
protected  Router router
           
 
Constructor Summary
BaseFriendlyURLMapper()
           
 
Method Summary
protected  void addParam(Map<String,String[]> parameterMap, String name, Object value)
          Deprecated. As of 6.2.0, replaced by addParameter(Map, String, Object)
protected  void addParam(Map<String,String[]> parameterMap, String name, String value)
          Deprecated. As of 6.2.0, replaced by addParameter(String, Map, String, String)
protected  void addParameter(Map<String,String[]> parameterMap, String name, Object value)
          Adds a default namespaced parameter of any type to the parameter map.
protected  void addParameter(Map<String,String[]> parameterMap, String name, String value)
          Adds a default namespaced string parameter to the parameter map.
protected  void addParameter(Map<String,String[]> parameterMap, String name, String[] values)
          Adds a default namespaced string parameter to the parameter map.
protected  void addParameter(String namespace, Map<String,String[]> parameterMap, String name, Object value)
          Adds a namespaced parameter of any type to the parameter map.
protected  void addParameter(String namespace, Map<String,String[]> parameterMap, String name, String value)
          Adds a namespaced string parameter to the parameter map.
protected  void addParameter(String namespace, Map<String,String[]> parameterMap, String name, String[] values)
          Adds a namespaced string parameter to the parameter map.
 String getMapping()
          Returns the friendly URL mapping for this portlet.
protected  String getNamespace()
          Returns the default namespace.
 String getPortletId()
          Returns the ID of this portlet
 Router getRouter()
          Returns the router for this friendly URL mapper
 boolean isCheckMappingWithPrefix()
          Returns true if the friendly URLs for this mapper should include the friendly URL separator.
 boolean isPortletInstanceable()
          Returns true if this portlet is instanceable.
 void setMapping(String mapping)
          Sets the friendly URL mapping for this portlet.
 void setPortletId(String portletId)
          Sets the ID of this portlet.
 void setPortletInstanceable(boolean portletInstanceable)
          Sets whether this portlet is instanceable.
 void setRouter(Router router)
          Sets the router for this friendly URL mapper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.liferay.portal.kernel.portlet.FriendlyURLMapper
buildPath, populateParams
 

Field Detail

router

protected Router router
Constructor Detail

BaseFriendlyURLMapper

public BaseFriendlyURLMapper()
Method Detail

getMapping

public String getMapping()
Description copied from interface: FriendlyURLMapper
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

Specified by:
getMapping in interface FriendlyURLMapper
Returns:
the friendly URL mapping for this portlet, not including any leading or trailing slashes

getPortletId

public String getPortletId()
Description copied from interface: FriendlyURLMapper
Returns the ID of this portlet

Specified by:
getPortletId in interface FriendlyURLMapper
Returns:
the ID of this portlet, not including the instance ID

getRouter

public Router getRouter()
Description copied from interface: FriendlyURLMapper
Returns the router for this friendly URL mapper

Specified by:
getRouter in interface FriendlyURLMapper
Returns:
the router, or null if one has not been set

isCheckMappingWithPrefix

public boolean isCheckMappingWithPrefix()
Description copied from interface: FriendlyURLMapper
Returns true if 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 PortalImpl when a friendly URL is processed.

It is strongly recommended that this method always return true.

Specified by:
isCheckMappingWithPrefix in interface FriendlyURLMapper
Returns:
true if the "/-/" separator should be included in friendly URLs, or false if only a "/" should be used

isPortletInstanceable

public boolean isPortletInstanceable()
Description copied from interface: FriendlyURLMapper
Returns true if 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.

Specified by:
isPortletInstanceable in interface FriendlyURLMapper
Returns:
true if the portlet is instanceable; false otherwise

setMapping

public void setMapping(String mapping)
Description copied from interface: FriendlyURLMapper
Sets the friendly URL mapping for this portlet.

This method is automatically called by PortletBagFactory with the friendly URL mapping defined in liferay-portlet.xml.

Specified by:
setMapping in interface FriendlyURLMapper
Parameters:
mapping - the friendly URL mapping for this portlet

setPortletId

public void setPortletId(String portletId)
Description copied from interface: FriendlyURLMapper
Sets the ID of this portlet.

This method is automatically called by PortletBagFactory with the portlet ID defined in liferay-portlet.xml.

Specified by:
setPortletId in interface FriendlyURLMapper
Parameters:
portletId - the ID of this portlet.

setPortletInstanceable

public void setPortletInstanceable(boolean portletInstanceable)
Description copied from interface: FriendlyURLMapper
Sets whether this portlet is instanceable.

Specified by:
setPortletInstanceable in interface FriendlyURLMapper
Parameters:
portletInstanceable - whether this portlet is instanceable

setRouter

public void setRouter(Router router)
Description copied from interface: FriendlyURLMapper
Sets the router for this friendly URL mapper.

This method is automatically called by PortletBagFactory with 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.

Specified by:
setRouter in interface FriendlyURLMapper
Parameters:
router - the router for this friendly URL mapper

addParam

protected void addParam(Map<String,String[]> parameterMap,
                        String name,
                        Object value)
Deprecated. As of 6.2.0, replaced by addParameter(Map, String, Object)


addParam

protected void addParam(Map<String,String[]> parameterMap,
                        String name,
                        String value)
Deprecated. As of 6.2.0, replaced by addParameter(String, Map, String, String)


addParameter

protected void addParameter(Map<String,String[]> parameterMap,
                            String name,
                            Object value)
Adds a default namespaced parameter of any type to the parameter map.

Do not use this method with an instanceable portlet, it will not properly namespace parameter names.

Parameters:
parameterMap - the parameter map
name - the name of the parameter
value - the value of the parameter
See Also:
addParameter(Map, String, String)

addParameter

protected void addParameter(Map<String,String[]> parameterMap,
                            String name,
                            String value)
Adds a default namespaced string parameter to the parameter map.

Do not use this method with an instanceable portlet, it will not properly namespace parameter names.

Parameters:
parameterMap - the parameter map
name - the name of the parameter
value - the value of the parameter
See Also:
getNamespace()

addParameter

protected void addParameter(Map<String,String[]> parameterMap,
                            String name,
                            String[] values)
Adds a default namespaced string parameter to the parameter map.

Do not use this method with an instanceable portlet, it will not properly namespace parameter names.

Parameters:
parameterMap - the parameter map
name - the name of the parameter
values - the values of the parameter
See Also:
getNamespace()

addParameter

protected void addParameter(String namespace,
                            Map<String,String[]> parameterMap,
                            String name,
                            Object value)
Adds a namespaced parameter of any type to the parameter map.

Parameters:
namespace - the namespace for portlet parameters. For instanceable portlets this must include the instance ID.
parameterMap - the parameter map
name - space the namespace for portlet parameters. For instanceable portlets this must include the instance ID.
value - the value of the parameter
See Also:
addParameter(String, Map, String, String)

addParameter

protected void addParameter(String namespace,
                            Map<String,String[]> parameterMap,
                            String name,
                            String value)
Adds a namespaced string parameter to the parameter map.

Parameters:
namespace - the namespace for portlet parameters. For instanceable portlets this must include the instance ID.
parameterMap - the parameter map
name - space the namespace for portlet parameters. For instanceable portlets this must include the instance ID.
value - the value of the parameter
See Also:
PortalUtil.getPortletNamespace(String), DefaultFriendlyURLMapper.getPortletId(Map)

addParameter

protected void addParameter(String namespace,
                            Map<String,String[]> parameterMap,
                            String name,
                            String[] values)
Adds a namespaced string parameter to the parameter map.

Parameters:
namespace - the namespace for portlet parameters. For instanceable portlets this must include the instance ID.
parameterMap - the parameter map
name - space the namespace for portlet parameters. For instanceable portlets this must include the instance ID.
values - the values of the parameter
See Also:
PortalUtil.getPortletNamespace(String), DefaultFriendlyURLMapper.getPortletId(Map)

getNamespace

protected String getNamespace()
Returns the default namespace.

Do not use this method with an instanceable portlet, it will not include the instance ID.

Returns:
the default namespace, not including the instance ID
See Also:
PortalUtil.getPortletNamespace(String)

Liferay 6.2-ce-ga5