public class CmsJspTagUserTracking
extends javax.servlet.jsp.tagext.TagSupport
<cms:usertracking/>
tag.This tag can be used to mark OpenCms files as visited or subscribe/unsubscribe them to/from users or groups.
It is also possible to check if single resources are visited/subscribed by the current user.
See also the CmsSubscriptionManager
for more information about subscription or visitation.
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
SESSION_PREFIX_SUBSCRIBED
Prefix for the visited session attributes.
|
static java.lang.String |
SESSION_PREFIX_VISITED
Prefix for the visited session attributes.
|
构造器和说明 |
---|
CmsJspTagUserTracking() |
限定符和类型 | 方法和说明 |
---|---|
int |
doStartTag() |
protected static java.lang.String |
generateSessionKey(java.lang.String prefix,
java.lang.String fileName,
boolean subFolder,
CmsUser user,
java.util.List<CmsGroup> groups)
Returns a unique session key depending on the values of the given parameters.
|
java.lang.String |
getAction()
Returns the action that should be performed, i.e. mark as visited or subscribe/unsubscribe.
|
java.lang.String |
getCurrentuser()
Returns the current user flag.
|
java.lang.String |
getFile()
Returns the file name to track.
|
java.lang.String |
getGroup()
Returns the group name that is used for the tracking.
|
java.lang.String |
getIncludegroups()
Returns the include groups flag.
|
java.lang.String |
getOnline()
Returns the online flag.
|
java.lang.String |
getSubfolder()
Returns the subfolder flag.
|
java.lang.String |
getUser()
Returns the user name that is used for the tracking.
|
protected static boolean |
isResourceSubscribed(CmsObject cms,
java.lang.String fileName,
boolean subFolder,
CmsUser user,
java.util.List<CmsGroup> groups,
javax.servlet.http.HttpServletRequest req)
Returns if the given resource is subscribed to the user or groups.
|
protected static boolean |
isResourceVisited(CmsObject cms,
java.lang.String fileName,
boolean subFolder,
CmsUser user,
javax.servlet.http.HttpServletRequest req)
Returns if the given resource was visited by the user.
|
void |
release() |
protected static void |
removeSessionAttributes(java.lang.String[] prefixes,
javax.servlet.http.HttpServletRequest req)
Removes all session attributes starting with the given prefixes.
|
void |
setAction(java.lang.String action)
Sets the action that should be performed, i.e. mark as visited or subscribe/unsubscribe.
|
void |
setCurrentuser(java.lang.String currentUser)
Sets the current user flag.
|
void |
setFile(java.lang.String file)
Sets the file name to track.
|
void |
setGroup(java.lang.String group)
Sets the group name that is used for the tracking.
|
void |
setIncludegroups(java.lang.String includeGroups)
Sets the include groups flag.
|
void |
setOnline(java.lang.String online)
Sets the online flag.
|
void |
setSubfolder(java.lang.String subfolder)
Sets the subfolder flag.
|
void |
setUser(java.lang.String user)
Sets the user name that is used for the tracking.
|
static java.lang.String |
userTrackingTagAction(java.lang.String action,
java.lang.String fileName,
boolean subFolder,
boolean currentUser,
java.lang.String userName,
boolean includeGroups,
java.lang.String groupName,
javax.servlet.http.HttpServletRequest req)
Tracks an OpenCms file according to the parameters.
|
public static final java.lang.String SESSION_PREFIX_SUBSCRIBED
public static final java.lang.String SESSION_PREFIX_VISITED
public static java.lang.String userTrackingTagAction(java.lang.String action, java.lang.String fileName, boolean subFolder, boolean currentUser, java.lang.String userName, boolean includeGroups, java.lang.String groupName, javax.servlet.http.HttpServletRequest req) throws javax.servlet.jsp.JspException
action
- the action that should be performedfileName
- the file name to tracksubFolder
- flag indicating if sub folders should be includedcurrentUser
- flag indicating if the current user should be used for the tracking actionuserName
- the user name that should be used for the actionincludeGroups
- flag indicating if the given users groups should be includedgroupName
- the group name that should be used for the actionreq
- the current requestjavax.servlet.jsp.JspException
- in case something goes wrongprotected static java.lang.String generateSessionKey(java.lang.String prefix, java.lang.String fileName, boolean subFolder, CmsUser user, java.util.List<CmsGroup> groups)
prefix
- the key prefix to usefileName
- the file name to tracksubFolder
- flag indicating if sub folders should be includeduser
- the user that should be usedgroups
- the groups that should be usedprotected static boolean isResourceSubscribed(CmsObject cms, java.lang.String fileName, boolean subFolder, CmsUser user, java.util.List<CmsGroup> groups, javax.servlet.http.HttpServletRequest req) throws CmsException
cms
- the current users contextfileName
- the file name to tracksubFolder
- flag indicating if sub folders should be includeduser
- the user that should be used for the checkgroups
- the groups that should be used for the checkreq
- the current requesttrue
if the given resource is subscribed to the user or groups, otherwise false
CmsException
- if something goes wrongprotected static boolean isResourceVisited(CmsObject cms, java.lang.String fileName, boolean subFolder, CmsUser user, javax.servlet.http.HttpServletRequest req) throws CmsException
cms
- the current users contextfileName
- the file name to tracksubFolder
- flag indicating if sub folders should be includeduser
- the user that should be used for the checkreq
- the current requesttrue
if the given resource was visited by the user, otherwise false
CmsException
- if something goes wrongprotected static void removeSessionAttributes(java.lang.String[] prefixes, javax.servlet.http.HttpServletRequest req)
prefixes
- the prefixes of the session attributes to removereq
- the current requestpublic int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
在接口中 javax.servlet.jsp.tagext.Tag
doStartTag
在类中 javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
Tag.doStartTag()
public java.lang.String getAction()
public java.lang.String getCurrentuser()
public java.lang.String getFile()
public java.lang.String getGroup()
public java.lang.String getIncludegroups()
public java.lang.String getOnline()
public java.lang.String getSubfolder()
public java.lang.String getUser()
public void release()
release
在接口中 javax.servlet.jsp.tagext.Tag
release
在类中 javax.servlet.jsp.tagext.TagSupport
Tag.release()
public void setAction(java.lang.String action)
action
- the action that should be performedpublic void setCurrentuser(java.lang.String currentUser)
Current user is false
by default.
currentUser
- the flag to setpublic void setFile(java.lang.String file)
file
- the file name to trackpublic void setGroup(java.lang.String group)
group
- the group name that is used for the trackingpublic void setIncludegroups(java.lang.String includeGroups)
Include groups is false
by default.
includeGroups
- the flag to setpublic void setOnline(java.lang.String online)
Online is false
by default.
online
- the flag to setpublic void setSubfolder(java.lang.String subfolder)
Online is false
by default.
subfolder
- the flag to setpublic void setUser(java.lang.String user)
user
- the user name that is used for the tracking