com.endeca.portal.liferay
Class LiferayUtils

java.lang.Object
  extended by com.endeca.portal.liferay.LiferayUtils

public class LiferayUtils
extends java.lang.Object


Constructor Summary
LiferayUtils()
           
 
Method Summary
static java.lang.String getDefaultLocale()
          Returns the default locale for the container.
static java.lang.String getPortalContext()
          Retrieves the main context path for the portal.
static java.util.Properties getPortalProperties()
          Retrieves all properties from portal-ext.properties.
static java.util.Properties getPortalProperties(java.lang.String prefix)
          Retrieves all properties from portal-ext.properties that start with a given prefix
static java.lang.String getPortalProperty(java.lang.String key)
          Retrieves a single property from portal-ext.properties.
static java.lang.String getRequestLocale(javax.portlet.PortletRequest request)
          Returns the locale to be used for the current request.
static java.lang.String getStaticResourceContext()
          Retrieves the URL path prefix to be used for static resources.
static boolean hasPrivilege(javax.portlet.PortletRequest request, java.lang.String privilege)
           
static boolean hasUpdatePrivileges(javax.portlet.PortletRequest request)
           
static boolean hasViewPrivileges(javax.portlet.PortletRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiferayUtils

public LiferayUtils()
Method Detail

getPortalContext

public static java.lang.String getPortalContext()
Retrieves the main context path for the portal. By default this is "/" but it can be overridden via the portal.ctx property in portal-ext.properties.

Returns:
the main context path for the portal

getStaticResourceContext

public static java.lang.String getStaticResourceContext()
Retrieves the URL path prefix to be used for static resources. By default, returns the same value as getPortalContext(). Users can customize this value in portal-ext.properties by setting the value of "endeca.static.resource.context". Setting a value of "/foo/" will reference that path on the current host; you can also set a fully-qualified url prefix such as "http://foo/bar/" to point to a different host.

Returns:
URL path prefix for static resources

getPortalProperty

public static java.lang.String getPortalProperty(java.lang.String key)
Retrieves a single property from portal-ext.properties.

Parameters:
key - the property to return
Returns:
the value of the property, or null if it does not exist.

getPortalProperties

public static java.util.Properties getPortalProperties()
Retrieves all properties from portal-ext.properties.

Returns:
the properties

getPortalProperties

public static java.util.Properties getPortalProperties(java.lang.String prefix)
Retrieves all properties from portal-ext.properties that start with a given prefix

Parameters:
prefix - the prefix by which to filter the properties
Returns:
the properties

hasPrivilege

public static boolean hasPrivilege(javax.portlet.PortletRequest request,
                                   java.lang.String privilege)

hasUpdatePrivileges

public static boolean hasUpdatePrivileges(javax.portlet.PortletRequest request)

hasViewPrivileges

public static boolean hasViewPrivileges(javax.portlet.PortletRequest request)

getDefaultLocale

public static java.lang.String getDefaultLocale()
Returns the default locale for the container.

Returns:
the locale

getRequestLocale

public static java.lang.String getRequestLocale(javax.portlet.PortletRequest request)
Returns the locale to be used for the current request.

Parameters:
request - the request
Returns:
the locale