KickJava   Java API By Example, From Geeks To Geeks.

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


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
18 import javax.servlet.http.*;
19
20 import com.ibm.webdav.*;
21
22 /**
23  * Executes the WebDAV Delta-V UncheckOut method.
24  *
25  * @author Michael Bell
26  * @version $Revision: 1.1 $
27  * @since November 18, 2003
28  */

29 public class UncheckOutMethod extends WebDAVMethod {
30     private static Logger m_logger = Logger.getLogger(UncheckOutMethod.class.getName());
31
32     public static String JavaDoc METHOD_NAME = "UNCHECKOUT";
33
34     /**
35      * @param request
36      * @param response
37      * @throws WebDAVException
38      */

39     public UncheckOutMethod(
40         HttpServletRequest request,
41         HttpServletResponse response)
42         throws WebDAVException {
43         super(request, response);
44         methodName = METHOD_NAME;
45     }
46
47     /* (non-Javadoc)
48      * @see com.ibm.webdav.protocol.http.WebDAVMethod#execute()
49      */

50     public WebDAVStatus execute() throws WebDAVException {
51         setStatusCode(WebDAVStatus.SC_CREATED); // the default status code
52
try {
53
54             context.setMethodName(METHOD_NAME);
55             resource.uncheckout();
56
57             setResponseHeaders();
58
59         } catch (WebDAVException exc) {
60             m_logger.log(Level.INFO, exc.getMessage() + " - " + request.getQueryString());
61             setStatusCode(exc.getStatusCode());
62             
63         } catch (Exception JavaDoc exc) {
64             m_logger.log(Level.WARNING, exc.getMessage(), exc);
65             setStatusCode(WebDAVStatus.SC_INTERNAL_SERVER_ERROR);
66         }
67         return context.getStatusCode();
68     }
69
70 }
71
Popular Tags