The online statistics function has far-reaching significance in enterprise-level applications. For example, some State-owned enterprises gradually deepen information construction, the maturity or ease of use of such construction is often reflected in the number of users and frequency of applications. This is also a reference for evaluating the effectiveness of the company's IT department.
Hy proposed a statistical function for filenet workplacext (XT), which is based on the real login application of users. The popular method is to use httpsessionlistener to listen for session creation and destruction (this is not discussed here ). In this practice, the top task of the transformation of XT itself is to find a way to obtain login information from non-open-source XT applications and add their own statistical functions.
First, obtain the userid and password on the wcmdefault. jsp page and save them to the session. The Code is as follows,
WcmDataStore dataStore = controller.getDataStore(); WcmServerCredentials credentials = dataStore.getServerCredentials();String userid = credentials.getUserId();String password = credentials.getPassword();session.setAttribute("loginStatisticUserId", userid);session.setAttribute("loginStatisticPassword", password);
Then add an Ajax call to the Browse. jsp page and call the logon statistics servlet (self-developed). Here, you can integrate the logic of the logon statistics logon process. The Code is as follows,
<script type="text/javascript"> Window.onload = $.ajax({ type:'get', url:'loginStatisticServlet', data:'data=', dataType:'text', success:function(msg){ }, error:function(){ } });</script>
Then create a servlet (the login logic is written in this class ),
Finally, configure in Web. xml. The Code is as follows,
<servlet> <servlet-name>LoginStatisticAction</servlet-name> <servlet-class>com.LoginStatisticServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>LoginStatisticAction</servlet-name> <url-pattern>/loginStatisticServlet</url-pattern> </servlet-mapping>
Similar issues are not too complex. You only need to decompile the project, read and analyze the login process, and find a way to obtain the login information. In the process of exploration, we must clarify our primary goal and accomplish it accurately without redundancy. For example, we need to conduct statistical work in several stages, where obtaining user login information is a stage, and converting user IDs into user names and other in-depth processing should be classified into subsequent stages, do not confuse them. Otherwise, it is difficult to control the workload, especially in the case of division of labor and cooperation. There are several tasks launched before the end of this month, and the division of labor to complete their respective good or exclusive (done similar or every time) functions, You need to clarify the goal, complete it accurately without redundancy (excluding the perspective of another high position ).