1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core;
17
18 import java.io.IOException;
19 import java.util.Date;
20
21 import javax.servlet.ServletException;
22 import javax.servlet.http.HttpServletRequest;
23 import javax.servlet.http.HttpServletResponse;
24
25 import org.apache.commons.lang.StringUtils;
26 import org.apache.log4j.Logger;
27 import org.kuali.rice.kns.web.struts.action.KualiRequestProcessor;
28
29 public class KPMERequestProcessor extends KualiRequestProcessor {
30
31 private static final Logger LOG = Logger.getLogger(KPMERequestProcessor.class);
32 private static final String PRIVACY_POLICY_KEY = "P3P";
33 private static final String PRIVACY_POLICY_VALUE = "CP=\"CAO DSP COR CURa ADMa DEVa CUSo TAIa PSAa PSDa OUR STP ONL UNI COM NAV INT DEM STA PRE\"";
34
35 @Override
36 public void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
37
38
39
40
41 Date startTime = new Date();
42
43 super.process(request, response);
44
45 String header = " Browser: " + request.getHeader("User-Agent");
46 if (StringUtils.isBlank(header)) {
47 header = "No header found";
48 }
49
50 response.setHeader(PRIVACY_POLICY_KEY, PRIVACY_POLICY_VALUE);
51
52 long totalTime = System.currentTimeMillis() - startTime.getTime();
53
54 LOG.info(new StringBuffer("Finished processing :: PERFORMANCE :: [[[Total Time: " + totalTime + "ms]]] ").append(request.getRequestURL()).append(header));
55
56 }
57
58 }