01: /**
02: *
03: */package org.enhydra.dm.handler;
04:
05: import java.io.IOException;
06:
07: import javax.servlet.ServletException;
08: import javax.servlet.http.HttpServletRequest;
09: import javax.servlet.http.HttpServletResponse;
10:
11: import org.enhydra.dm.api.handler.AbstractHandler;
12: import org.enhydra.dm.api.loggers.Log;
13: import org.enhydra.dm.util.EnhydraDMConstants;
14:
15: /**
16: * Default implementation of a handler for requests using the HTTP OPTIONS method.
17: *
18: * @author Slobodan Vujasinovic
19: */
20: public class DefaultOptionsHandler extends AbstractHandler {
21:
22: /**
23: * Services requests which use the HTTP OPTIONS method. This implementation provides
24: * the list of supported methods for the target resource.
25: *
26: * @param request The request being serviced.
27: * @param response The servlet response.
28: * @throws ServletException If an application error occurs.
29: * @throws IOException If an IO error occurs while handling the request.
30: */
31:
32: public void service(HttpServletRequest request,
33: HttpServletResponse response) throws IOException,
34: ServletException {
35: if (null != getLogger()) {
36: getLogger().log(Log.DEBUG,
37: "OPTIONS Request for document (id)\"{0}\".");
38: }
39:
40: response.setHeader("DAV", "1,2");
41: response.setHeader("MS-Author-Via", "DAV");
42: response.setHeader(EnhydraDMConstants.HEAD_ALLOW,
43: getAllowedMethods());
44: }
45:
46: }
|