1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.webdav;
24  
25  import com.liferay.portal.kernel.util.GetterUtil;
26  import com.liferay.portal.kernel.util.StringPool;
27  import com.liferay.portal.security.permission.PermissionChecker;
28  
29  import javax.servlet.http.HttpServletRequest;
30  import javax.servlet.http.HttpServletResponse;
31  
32  /**
33   * <a href="WebDAVRequest.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Brian Wing Shun Chan
36   */
37  public class WebDAVRequest {
38  
39      public WebDAVRequest(
40              WebDAVStorage storage, HttpServletRequest request,
41              HttpServletResponse response, PermissionChecker permissionChecker)
42          throws WebDAVException {
43  
44          _storage = storage;
45          _request = request;
46          _response = response;
47          _lockUuid = WebDAVUtil.getLockUuid(request);
48          _path = WebDAVUtil.fixPath(_request.getPathInfo());
49          _companyId = WebDAVUtil.getCompanyId(_path);
50          _groupId = WebDAVUtil.getGroupId(_path);
51          _userId = GetterUtil.getLong(_request.getRemoteUser());
52          _permissionChecker = permissionChecker;
53      }
54  
55      public WebDAVStorage getWebDAVStorage() {
56          return _storage;
57      }
58  
59      public HttpServletRequest getHttpServletRequest() {
60          return _request;
61      }
62  
63      public HttpServletResponse getHttpServletResponse() {
64          return _response;
65      }
66  
67      public String getRootPath() {
68          return _storage.getRootPath();
69      }
70  
71      public String getPath() {
72          return _path;
73      }
74  
75      public String[] getPathArray() {
76          return WebDAVUtil.getPathArray(_path);
77      }
78  
79      public long getCompanyId() {
80          return _companyId;
81      }
82  
83      public long getGroupId() {
84          return _groupId;
85      }
86  
87      public long getUserId() {
88          return _userId;
89      }
90  
91      public String getLockUuid() {
92          return _lockUuid;
93      }
94  
95      public PermissionChecker getPermissionChecker() {
96          return _permissionChecker;
97      }
98  
99      private WebDAVStorage _storage;
100     private HttpServletRequest _request;
101     private HttpServletResponse _response;
102     private String _path = StringPool.BLANK;
103     private long _companyId;
104     private long _groupId;
105     private long _userId;
106     private String _lockUuid;
107     private PermissionChecker _permissionChecker;
108 
109 }