1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.container.servlet

File ServletRequest.java

 

Coverage histogram

../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

4
15
6
1
84
49
8
0.53
2.5
6
1.33

Classes

Class Line # Actions
ServletRequest 30 15 0% 8 4
0.8484%
 

Contributing tests

This file is covered by 6 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.container.servlet;
21   
22    import java.util.ArrayList;
23    import java.util.Arrays;
24    import java.util.List;
25   
26    import org.xwiki.container.Request;
27   
28    import javax.servlet.http.HttpServletRequest;
29   
 
30    public class ServletRequest implements Request
31    {
32    private HttpServletRequest httpServletRequest;
33   
 
34  13165 toggle public ServletRequest(HttpServletRequest httpServletRequest)
35    {
36  13166 this.httpServletRequest = httpServletRequest;
37    }
38   
 
39  1719 toggle public HttpServletRequest getHttpServletRequest()
40    {
41  1719 return this.httpServletRequest;
42    }
43   
 
44  15267 toggle @Override
45    public Object getProperty(String key)
46    {
47  15273 Object result;
48   
49    // Look first in the Query Parameters and then in the Query Attributes
50  15275 result = this.httpServletRequest.getParameter(key);
51  15274 if (result == null) {
52  15145 result = this.httpServletRequest.getAttribute(key);
53    }
54   
55  15277 return result;
56    }
57   
 
58  3 toggle @Override
59    public List<Object> getProperties(String key)
60    {
61  3 List<Object> result = new ArrayList<Object>();
62   
63    // Look first in the Query Parameters and then in the Query Attributes
64  3 Object[] requestParameters = this.httpServletRequest.getParameterValues(key);
65  3 if (requestParameters != null) {
66  2 result.addAll(Arrays.asList(requestParameters));
67    }
68  3 result.add(this.httpServletRequest.getAttribute(key));
69   
70  3 return result;
71    }
72   
 
73  0 toggle @Override
74    public void setProperty(String key, Object value)
75    {
76  0 this.httpServletRequest.setAttribute(key, value);
77    }
78   
 
79  0 toggle @Override
80    public void removeProperty(String key)
81    {
82  0 this.httpServletRequest.removeAttribute(key);
83    }
84    }