001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.webdav;
022:
023: import com.liferay.portal.kernel.security.permission.PermissionChecker;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.kernel.util.StringPool;
026:
027: import javax.servlet.http.HttpServletRequest;
028: import javax.servlet.http.HttpServletResponse;
029:
030: /**
031: * <a href="WebDAVRequest.java.html"><b><i>View Source</i></b></a>
032: *
033: * @author Brian Wing Shun Chan
034: *
035: */
036: public class WebDAVRequest {
037:
038: public WebDAVRequest(WebDAVStorage storage, HttpServletRequest req,
039: HttpServletResponse res, PermissionChecker permissionChecker) {
040:
041: _storage = storage;
042: _req = req;
043: _res = res;
044: _path = WebDAVUtil.fixPath(_req.getPathInfo());
045: _groupPath = WebDAVUtil.isGroupPath(_path);
046: _companyId = WebDAVUtil.getCompanyId(_path);
047: _groupId = WebDAVUtil.getGroupId(_path);
048: _userId = GetterUtil.getLong(_req.getRemoteUser());
049: _permissionChecker = permissionChecker;
050: }
051:
052: public WebDAVStorage getWebDAVStorage() {
053: return _storage;
054: }
055:
056: public HttpServletRequest getHttpServletRequest() {
057: return _req;
058: }
059:
060: public HttpServletResponse getHttpServletResponse() {
061: return _res;
062: }
063:
064: public String getRootPath() {
065: return _storage.getRootPath();
066: }
067:
068: public String getPath() {
069: return _path;
070: }
071:
072: public String[] getPathArray() {
073: return WebDAVUtil.getPathArray(_path);
074: }
075:
076: public boolean isGroupPath() {
077: return _groupPath;
078: }
079:
080: public long getCompanyId() {
081: return _companyId;
082: }
083:
084: public long getGroupId() {
085: return _groupId;
086: }
087:
088: public long getUserId() {
089: return _userId;
090: }
091:
092: public PermissionChecker getPermissionChecker() {
093: return _permissionChecker;
094: }
095:
096: private WebDAVStorage _storage;
097: private HttpServletRequest _req;
098: private HttpServletResponse _res;
099: private String _path = StringPool.BLANK;
100: private boolean _groupPath;
101: private long _companyId;
102: private long _groupId;
103: private long _userId;
104: private PermissionChecker _permissionChecker;
105:
106: }
|