Friday, April 10, 2009

portlet statistics about the number of users online wps 5.1

Just to follow up the earliar post for wps 6 and here it is to implement for 5.1.

Next on this series for 6.1.

portlet statistics about the number of users online

Problem: jsp is HttpSessionListener interface implementation, portlet in how is this not possible or that there are other interface?
My wps is 5.1, tested landing users can record, code as follows

private static int activeSessions = 0;

/** / **
* @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)

* /
public void sessionCreated(HttpSessionEvent se) {
} )

/** / **
* @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)

* /
public void sessionDestroyed(HttpSessionEvent se) {
if(activeSessions > 0)
} )

/** Online access to the current number of
* @ Return the current line number
*/ * /
public static int getActiveSessions() {

return activeSessions;
} )

Can not record if anonymous, prompt: NO PORTLET SESSION YET.
Do not know how this custom? Give a prompt, thank you


In fact, implementation of this feature is not particularly difficult, it is important that you must know the work of the whole mechanism of the container Portal. Because of the length of questions, I will not elaborate too much here at Portal container is how the job.

Online for your statistics on the number of questions, you can understand that: the entire Portal page is being assembled and rendering, that is the root Portal page where it is. Portal page exist in the root of the Portal Server directory installedApps application wps EAR, if you have custom themes and skins on the know.

Well, about the number of online statistics, statistics on the number that must be at the EAR in the wps to worry too much about the application and follow-up.
web.xml such as in the configuration file, add the following filter and listener



...... ......
...... ......

Now you use this to display stat in whatever way you want.