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