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.webdav.methods;
016    
017    import com.liferay.portal.kernel.util.StringUtil;
018    import com.liferay.portal.kernel.webdav.WebDAVException;
019    import com.liferay.portal.kernel.webdav.WebDAVRequest;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     * @author Alexander Chow
024     */
025    public interface Method {
026    
027            public static final String COPY = "COPY";
028    
029            public static final String DELETE = "DELETE";
030    
031            public static final String GET = "GET";
032    
033            public static final String HEAD = "HEAD";
034    
035            public static final String LOCK = "LOCK";
036    
037            public static final String MKCOL = "MKCOL";
038    
039            public static final String MOVE = "MOVE";
040    
041            public static final String OPTIONS = "OPTIONS";
042    
043            public static final String PROPFIND = "PROPFIND";
044    
045            public static final String PROPPATCH = "PROPPATCH";
046    
047            public static final String PUT = "PUT";
048    
049            public static final String[] SUPPORTED_METHODS_ARRAY = {
050                    COPY, DELETE, GET, HEAD, LOCK, MKCOL, MOVE, OPTIONS, PROPFIND,
051                    PROPPATCH, PUT, Method.UNLOCK
052            };
053    
054            public static final String SUPPORTED_METHODS = StringUtil.merge(
055                    SUPPORTED_METHODS_ARRAY);
056    
057            public static final String UNLOCK = "UNLOCK";
058    
059            /**
060             * Returns -1 or a supported HTTP status code. If it is -1, then the status
061             * code has already been set. Otherwise, the status code needs to be set by
062             * the caller.
063             *
064             * @param  webDavRequest the WebDAV request
065             * @return -1 or a supported HTTP status code. If it is -1, then the status
066             *         code has already been set. Otherwise, the status code needs to be
067             *         set by the caller.
068             * @throws WebDAVException if a WebDAV exception occurred
069             */
070            public int process(WebDAVRequest webDavRequest) throws WebDAVException;
071    
072    }