01: /*
02: * (C) Copyright Simulacra Media Ltd, 2004. All rights reserved.
03: *
04: * The program is provided "AS IS" without any warranty express or
05: * implied, including the warranty of non-infringement and the implied
06: * warranties of merchantibility and fitness for a particular purpose.
07: * Simulacra Media Ltd will not be liable for any damages suffered by you as a result
08: * of using the Program. In no event will Simulacra Media Ltd be liable for any
09: * special, indirect or consequential damages or lost profits even if
10: * Simulacra Media Ltd has been advised of the possibility of their occurrence.
11: * Simulacra Media Ltd will not be liable for any third party claims against you.
12: *
13: */
14: package com.ibm.webdav.protocol.http;
15:
16: import java.util.logging.*;
17: import java.util.logging.Logger;
18:
19: import javax.servlet.http.HttpServletRequest;
20: import javax.servlet.http.HttpServletResponse;
21:
22: import com.ibm.webdav.WebDAVException;
23: import com.ibm.webdav.WebDAVStatus;
24:
25: /**
26: * Executes the WebDAV Delta-V CheckIn method.
27: *
28: * @author Michael Bell
29: * @version $Revision: 1.1 $
30: * @since November 13, 2003
31: */
32: public class CheckInMethod extends WebDAVMethod {
33:
34: public static final String METHOD_NAME = "CHECKIN";
35:
36: private static Logger m_logger = Logger
37: .getLogger(CheckInMethod.class.getName());
38:
39: /**
40: * @param request
41: * @param response
42: * @throws WebDAVException
43: */
44: public CheckInMethod(HttpServletRequest request,
45: HttpServletResponse response) throws WebDAVException {
46: super (request, response);
47: methodName = METHOD_NAME;
48: }
49:
50: /* (non-Javadoc)
51: * @see com.ibm.webdav.protocol.http.WebDAVMethod#execute()
52: */
53: public WebDAVStatus execute() throws WebDAVException {
54: setStatusCode(WebDAVStatus.SC_CREATED); // the default status code
55: try {
56:
57: context.setMethodName(METHOD_NAME);
58: resource.checkin();
59:
60: setResponseHeaders();
61:
62: } catch (WebDAVException exc) {
63: m_logger.log(Level.INFO, exc.getLocalizedMessage() + " - "
64: + request.getQueryString());
65: setStatusCode(exc.getStatusCode());
66:
67: } catch (Exception exc) {
68: m_logger.log(Level.WARNING,
69: "Check in Method: unhandled exception: ", exc);
70: setStatusCode(WebDAVStatus.SC_INTERNAL_SERVER_ERROR);
71: }
72: return context.getStatusCode();
73: }
74:
75: }
|