lumis.portal.url
Class WebResource

Package class diagram package WebResource
java.lang.Object
  extended by lumis.portal.url.WebResource
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
ChannelWebResource, PageWebResource

@StableMinor(version="5.5",
             sinceVersion="5.0")
public abstract class WebResource
extends Object
implements Cloneable

Represents a resource that is accessible through a web server.

Note: the public methods of this class are considered stable, but it is not considered stable for being used in JPA queries.

Since:
5.0.0

Constructor Summary
WebResource()
           
 
Method Summary
protected  WebResource clone()
           
 Date getCreatedDateTime()
          Returns the date-time this web resource was created.
 String getDynamicPath()
          Returns the dynamic path to access this web resource.
 String getFriendlyPath()
          Returns the friendly path to access this web resource.
 String getFriendlyURLPattern()
          Returns the pattern to be used to resolve friendly URL for this web resource.
 String getId()
          Returns the unique identifier for this web resource.
 Locale getLocale()
          Returns the locale for this web resource.
abstract  String getName()
          Returns the name for this web resource.
 PageCacheConfig getPageCache()
          Returns the cache definition for this web resource.
 String getParameter(String parameterName)
          Returns the value of a parameter for this web resource.
abstract  Map<String,String[]> getParameterMap()
          Returns a map containing all parameters for this web resource.
 String[] getParameterValues(String parameterName)
          Returns the values of a parameter for this web resource.
abstract  WebResource getParent()
          Returns the web resource of the parent element of this web resource.
 String getPath()
          Returns the path to access this web resource.
protected  String getPath(boolean considerGuestOnlyCache)
          Returns the path to access this web resource.
abstract  Map<String,List<String>> getProperties()
          Returns the properties for this web resource.
abstract  String getTitle()
          Returns the title for this web resource.
 boolean isCacheEnabled(boolean considerGuestOnlyCache)
          Returns if the cache is enabled for this web resource for the current user.
protected  boolean isFriendlyURLEnabled()
          Indicates if friendly URL is enabled for this web resource.
protected  String localize(String key)
          Returns the localized version of the given string.
protected  void setDynamicPath(String dynamicPath)
          Sets the dynamic path for this web resource.
protected  void setFriendlyPath(String friendlyPath)
          Sets the friendly path for this web resource.
protected  void setId(String id)
          Sets the unique identifier for this web resource.
protected  void setLocale(Locale locale)
          Sets the locale for this web resource.
protected  void setPageCache(PageCacheConfig pageCache)
          Sets the cache definition for this web resource.
 String toString()
          Returns a string representation for debug and logging purposes.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebResource

public WebResource()
Method Detail

getId

public String getId()
Returns the unique identifier for this web resource.

Returns:
the unique identifier for this web resource, or null if it is not persisted.
Since:
5.0.0

setId

protected void setId(String id)
Sets the unique identifier for this web resource.

Parameters:
id - the value to set.
Since:
5.0.0

getDynamicPath

public String getDynamicPath()
Returns the dynamic path to access this web resource. The dynamic path, starts with '/' and is relative to the portal web application root.

Returns:
the dynamic path for this web resource.
Since:
5.0.0
See Also:
getFriendlyPath()

setDynamicPath

protected void setDynamicPath(String dynamicPath)
Sets the dynamic path for this web resource.

Parameters:
dynamicPath - the dynamic path relative to the portal web application root. It must start with '/'.
Since:
5.0.0

getFriendlyPath

public String getFriendlyPath()
Returns the friendly path to access this web resource. The friendly path, if set, always starts with '/' and is relative to the portal web application root.

Note that even thought a friendly path is returned, the use of friendly URL may be disabled for this web resource.

Returns:
the friendly path or null if there is no friendly path set.
Since:
5.0.0
See Also:
getPath()

isFriendlyURLEnabled

protected boolean isFriendlyURLEnabled()
Indicates if friendly URL is enabled for this web resource.

Returns:
true if it is enabled, false otherwise.
Since:
5.0.0

setFriendlyPath

protected void setFriendlyPath(String friendlyPath)
Sets the friendly path for this web resource.

Parameters:
friendlyPath - the friendly path relative to the portal web application root. It must start with '/', or be null for no friendly path set.
Since:
5.0.0

getFriendlyURLPattern

public String getFriendlyURLPattern()
Returns the pattern to be used to resolve friendly URL for this web resource.

The specific syntax or usage of the pattern is up to the IURLResolver configured for this web resource.

Returns:
the pattern.
Since:
5.0.0

getLocale

public Locale getLocale()
Returns the locale for this web resource.

Returns:
the locale.
Since:
5.0.0

setLocale

protected void setLocale(Locale locale)
Sets the locale for this web resource.

Parameters:
locale - the locale to set.
Since:
5.0.0

getCreatedDateTime

public Date getCreatedDateTime()
Returns the date-time this web resource was created.

Returns:
the date-time this web resource was created.
Since:
5.0.0

getPageCache

public PageCacheConfig getPageCache()
Returns the cache definition for this web resource.

Returns:
the cache object or null if this web resource does not have cache.
Since:
5.0.0

setPageCache

protected void setPageCache(PageCacheConfig pageCache)
Sets the cache definition for this web resource.

Parameters:
pageCache - the cache definition.
Since:
5.0.0

getPath

public final String getPath()
Returns the path to access this web resource. The returned value is taken from cache configuration, getFriendlyPath() or getDynamicPath().

The current user session affects the resolution if a cache should or not be used.

Returns:
the path to access this web resource, starting with '/' and relative to the portal web application root.
Since:
5.0.0

getPath

protected String getPath(boolean considerGuestOnlyCache)
Returns the path to access this web resource. The returned value is taken from cache configuration, getFriendlyPath() or getDynamicPath().

Parameters:
considerGuestOnlyCache - indicates if the path for the cached file should be used even if the cache is only for guest.
Returns:
the path to access this web resource, starting with '/' and relative to the portal web application root.
Since:
5.0.0

isCacheEnabled

public boolean isCacheEnabled(boolean considerGuestOnlyCache)
Returns if the cache is enabled for this web resource for the current user.

Parameters:
considerGuestOnlyCache - indicates if the result should be true even if the cache is only for guest.
Returns:
true if the cache is enabled, false otherwise.
Since:
5.0.0

getParent

public abstract WebResource getParent()
Returns the web resource of the parent element of this web resource.

Returns:
the parent of this web resource, or null if it has no parent.
Since:
5.0.0

getName

public abstract String getName()
Returns the name for this web resource. The name is usually used for management display purposes.

Returns:
this web resource's name, localized according to its locale.
Since:
5.0.0
See Also:
getLocale()

getTitle

public abstract String getTitle()
Returns the title for this web resource. The title is usually used as an end-user title.

Returns:
this web resource's title, localized according to its locale.
Since:
5.0.0
See Also:
getLocale()

getParameterMap

public abstract Map<String,String[]> getParameterMap()
Returns a map containing all parameters for this web resource.

Returns:
an immutable map containing all parameters for this web resource.
Since:
5.0.0

getParameter

public String getParameter(String parameterName)
Returns the value of a parameter for this web resource. If the parameter has multiple values, the first is returned.

Parameters:
parameterName - the parameter name.
Returns:
the value, or null if no parameter with such name exists for this web resource.
Since:
5.0.0

getParameterValues

public String[] getParameterValues(String parameterName)
Returns the values of a parameter for this web resource.

Parameters:
parameterName - the parameter name.
Returns:
the values, or null if no parameter with such name exists for this web resource.
Since:
5.0.0

getProperties

public abstract Map<String,List<String>> getProperties()
Returns the properties for this web resource.

Returns:
a immutable map where the key is the property name and the value is a list of the property's values.
Since:
5.0.0

localize

protected String localize(String key)
Returns the localized version of the given string. The localization is done based on this web resource's locale.

Parameters:
key - the string.
Returns:
the localized version.
Since:
5.0.0
See Also:
getLocale()

toString

public String toString()
Returns a string representation for debug and logging purposes.

Overrides:
toString in class Object
Returns:
string representation for debug and logging purposes.
Since:
5.0.0

clone

protected WebResource clone()
                     throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Lumisportal  5.5.0.091130 - Copyright © 2001-2007, Lumis. All Rights Reserved.