001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.webdav.methods;
016    
017    import com.liferay.portal.kernel.webdav.WebDAVException;
018    import com.liferay.portal.kernel.webdav.WebDAVRequest;
019    
020    /**
021     * @author Brian Wing Shun Chan
022     * @author Alexander Chow
023     */
024    public interface Method {
025    
026            public static final String COPY = "COPY";
027    
028            public static final String DELETE = "DELETE";
029    
030            public static final String GET = "GET";
031    
032            public static final String HEAD = "HEAD";
033    
034            public static final String LOCK = "LOCK";
035    
036            public static final String MKCOL = "MKCOL";
037    
038            public static final String MOVE = "MOVE";
039    
040            public static final String OPTIONS = "OPTIONS";
041    
042            public static final String PROPFIND = "PROPFIND";
043    
044            public static final String PROPPATCH = "PROPPATCH";
045    
046            public static final String PUT = "PUT";
047    
048            public static final String[] SUPPORTED_METHOD_NAMES = {
049                    COPY, DELETE, GET, HEAD, LOCK, MKCOL, MOVE, OPTIONS, PROPFIND,
050                    PROPPATCH, PUT, Method.UNLOCK
051            };
052    
053            public static final String UNLOCK = "UNLOCK";
054    
055            /**
056             * Returns -1 or a supported HTTP status code. If it is -1, then the status
057             * code has already been set. Otherwise, the status code needs to be set by
058             * the caller.
059             *
060             * @param  webDAVRequest the WebDAV request
061             * @return -1 or a supported HTTP status code. If it is -1, then the status
062             *         code has already been set. Otherwise, the status code needs to be
063             *         set by the caller.
064             * @throws WebDAVException if a WebDAV exception occurred
065             */
066            public int process(WebDAVRequest webDAVRequest) throws WebDAVException;
067    
068    }