0
|
1 <%
|
|
2 package nabble.view.web.w3c;
|
|
3
|
|
4 import fschmidt.util.servlet.JtpContext;
|
|
5 import nabble.view.lib.UrlMappable;
|
|
6 import nabble.view.lib.Cache;
|
|
7
|
|
8 import javax.servlet.ServletException;
|
|
9 import javax.servlet.http.HttpServlet;
|
|
10 import javax.servlet.http.HttpServletRequest;
|
|
11 import javax.servlet.http.HttpServletResponse;
|
|
12 import java.io.IOException;
|
|
13 import java.io.PrintWriter;
|
|
14 import java.util.HashMap;
|
|
15 import java.util.Map;
|
|
16 import java.util.regex.Matcher;
|
|
17 import java.util.regex.Pattern;
|
|
18
|
|
19 public final class P3PXML extends HttpServlet implements UrlMappable {
|
|
20
|
|
21 private static final Pattern URL_PATTERN = Pattern.compile("/w3c/p3p.xml$");
|
|
22
|
|
23 private static String path() {
|
|
24 return "/w3c/p3p.xml";
|
|
25 }
|
|
26
|
|
27 public Map<String, String[]> getParameterMapFromUrl(HttpServletRequest request,String mappedUrl) {
|
|
28 Matcher m = URL_PATTERN.matcher(mappedUrl);
|
|
29 if (!m.find())
|
|
30 throw new RuntimeException();
|
|
31 Map<String,String[]> params = new HashMap<String,String[]>();
|
|
32 return params;
|
|
33 }
|
|
34
|
|
35 public Pattern getUrlPattern() {
|
|
36 return URL_PATTERN;
|
|
37 }
|
|
38
|
|
39 protected void service(HttpServletRequest request, HttpServletResponse response)
|
|
40 throws ServletException, IOException {
|
|
41
|
|
42 JtpContext jtpContext = (JtpContext)getServletContext().getAttribute(JtpContext.attrName);
|
|
43 jtpContext.setEtag(request,response);
|
|
44 PrintWriter out = response.getWriter();
|
|
45 response.setContentType("text/xml");
|
|
46 %>
|
|
47 <META xmlns="http://www.w3.org/2002/01/P3Pv1">
|
|
48 <POLICY-REFERENCES>
|
|
49 <POLICY-REF about="http://<%=request.getHeader("host")%>/w3c/policy.xml#Policy">
|
|
50 <INCLUDE>/*</INCLUDE>
|
|
51 <COOKIE-INCLUDE name="*" value="*" domain="<%=request.getHeader("host")%>"/>
|
|
52 </POLICY-REF>
|
|
53 </POLICY-REFERENCES>
|
|
54 </META>
|
|
55 <%
|
|
56 }
|
|
57 }
|
|
58 %> |