KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibm > webdav > protocol > http > CheckOutMethod


1 /*
2  * (C) Copyright Simulacra Media Ltd, 2004. All rights reserved.
3  *
4  * The program is provided "AS IS" without any warranty express or
5  * implied, including the warranty of non-infringement and the implied
6  * warranties of merchantibility and fitness for a particular purpose.
7  * Simulacra Media Ltd will not be liable for any damages suffered by you as a result
8  * of using the Program. In no event will Simulacra Media Ltd be liable for any
9  * 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.Level JavaDoc;
18
19 import javax.servlet.http.HttpServletRequest JavaDoc;
20 import javax.servlet.http.HttpServletResponse JavaDoc;
21
22 import com.ibm.webdav.WebDAVException;
23 import com.ibm.webdav.WebDAVStatus;
24
25 /**
26  * Executes the WebDAV Delta-V CheckOut method.
27  *
28  * @author Michael Bell
29  * @version $Revision: 1.1 $
30  * @since November 13, 2003
31  */

32 public class CheckOutMethod extends WebDAVMethod {
33
34     public static final String JavaDoc METHOD_NAME = "CHECKOUT";
35     
36     private static Logger m_logger = Logger.getLogger(CheckOutMethod.class.getName());
37
38
39     /**
40      * @param request
41      * @param response
42      * @throws WebDAVException
43      */

44     public CheckOutMethod(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
45         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.checkout();
59
60             setResponseHeaders();
61
62         } catch (WebDAVException exc) {
63             m_logger.log(Level.INFO, exc.getLocalizedMessage() + " - " + request.getQueryString());
64             setStatusCode(exc.getStatusCode());
65             
66         } catch (Exception JavaDoc exc) {
67             m_logger.log(Level.WARNING, "Check out Method: unhandled exception: ", exc);
68             setStatusCode(WebDAVStatus.SC_INTERNAL_SERVER_ERROR);
69         }
70         return context.getStatusCode();
71     }
72
73 }
74
Popular Tags