1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.web;
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.hr.time.util.TKContext;
28 import org.kuali.rice.kns.web.struts.action.KualiRequestProcessor;
29
30 public class TKRequestProcessor extends KualiRequestProcessor {
31
32 private static final Logger LOG = Logger.getLogger(TKRequestProcessor.class);
33 private static final String PRIVACY_POLICY_KEY = "P3P";
34 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\"";
35
36 @Override
37 public void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
38
39
40
41
42 Date startTime = new Date();
43
44 TKContext.clear();
45 TKContext.setHttpServletRequest(request);
46 super.process(request, response);
47
48 String header = " Browser: " + request.getHeader("User-Agent");
49 if (StringUtils.isBlank(header)) {
50 header = "No header found";
51 }
52
53 response.setHeader(PRIVACY_POLICY_KEY, PRIVACY_POLICY_VALUE);
54
55 long totalTime = System.currentTimeMillis() - startTime.getTime();
56
57 LOG.info(new StringBuffer("Finished processing :: PERFORMANCE :: [[[Total Time: " + totalTime + "ms]]] ").append(request.getRequestURL()).append(header));
58
59 }
60
61 }