01: package org.enhydra.dm.handler;
02:
03: import java.io.IOException;
04:
05: import javax.servlet.ServletException;
06: import javax.servlet.http.HttpServletRequest;
07: import javax.servlet.http.HttpServletResponse;
08:
09: import org.enhydra.dm.api.handler.AbstractHandler;
10:
11: public class DefaultReportHandler extends AbstractHandler {
12:
13: /**
14: * THIS HANDLER CURRENTLY NOT IN USE! <br>
15: * Services requests which use the WebDAV VERSION-REPORT method.
16: *
17: * @param request The request being serviced.
18: * @param response The servlet response.
19: * @throws ServletException If an application error occurs.
20: * @throws IOException If an IO error occurs while handling the request.
21: */
22: public void service(HttpServletRequest request,
23: HttpServletResponse response) throws ServletException,
24: IOException {
25:
26: String content = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"
27: + "<multistatus xmlns=\"DAV:\">";
28:
29: if (true) {
30: // document versions exist
31: content = content
32: + "<response>"
33: + "<href>"
34: + request.getRequestURI()
35: + "</href>"
36: + "<propstat>"
37: + "<prop>"
38: + "<version-name>V1</version-name>"
39: + "<creator-displayname>Vladimir</creator-displayname>"
40: + "<successor-set>"
41: + "<href>"
42: + request.getRequestURI()
43: + "</href>"
44: + "<href>"
45: + request.getRequestURI()
46: + "</href>"
47: + "</successor-set>"
48: + "</prop>"
49: + "<status>HTTP/1.1 200 OK</status>"
50: + "</propstat>"
51: + "</response>"
52: +
53:
54: "<response>"
55: + "<href>"
56: + request.getRequestURI()
57: + "</href>"
58: + "<propstat>"
59: + "<prop>"
60: + "<version-name>V2</version-name>"
61: + "<creator-displayname>Svjetlana</creator-displayname>"
62: + "<successor-set/>"
63: + "</prop>"
64: + "<status>HTTP/1.1 200 OK</status>"
65: + "</propstat>"
66: + "</response>"
67: +
68:
69: "<response>"
70: + "<href>"
71: + request.getRequestURI()
72: + "</href>"
73: + "<propstat>"
74: + "<prop>"
75: + "<version-name>V2.1.1</version-name>"
76: + "<creator-displayname>Slobodan</creator-displayname>"
77: + "<successor-set/>" + "</prop>"
78: + "<status>HTTP/1.1 200 OK</status>"
79: + "</propstat>" + " </response>";
80: } else {
81: // do nothing
82: }
83:
84: content = content + "</multistatus>";
85:
86: response.getWriter().write(content);
87: response.setStatus(207);
88: response.setContentType("text/xml; charset=\"utf-8\"");
89:
90: }
91:
92: }
|