KickJava   Java API By Example, From Geeks To Geeks.

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


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.Logger 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 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 JavaDoc METHOD_NAME = "CHECKIN";
35     
36     private static Logger JavaDoc m_logger = Logger.getLogger(CheckInMethod.class.getName());
37
38     /**
39      * @param request
40      * @param response
41      * @throws WebDAVException
42      */

43     public CheckInMethod(
44         HttpServletRequest JavaDoc request,
45         HttpServletResponse JavaDoc response)
46         throws WebDAVException {
47         super(request, response);
48         methodName = METHOD_NAME;
49     }
50
51     /* (non-Javadoc)
52      * @see com.ibm.webdav.protocol.http.WebDAVMethod#execute()
53      */

54     public WebDAVStatus execute() throws WebDAVException {
55         setStatusCode(WebDAVStatus.SC_CREATED); // the default status code
56
try {
57
58             context.setMethodName(METHOD_NAME);
59             resource.checkin();
60
61             setResponseHeaders();
62             
63
64         } catch (WebDAVException exc) {
65             m_logger.log(Level.INFO, exc.getLocalizedMessage() + " - " + request.getQueryString());
66             setStatusCode(exc.getStatusCode());
67             
68         } catch (Exception JavaDoc exc) {
69             m_logger.log(Level.WARNING, "Check in Method: unhandled exception: ", exc);
70             setStatusCode(WebDAVStatus.SC_INTERNAL_SERVER_ERROR);
71         }
72         return context.getStatusCode();
73     }
74
75 }
76
Popular Tags