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

File ServletApplicationContext.java

 

Coverage histogram

../../../../img/srcFileCovDistChart7.png
64% of files have more coverage

Code metrics

0
6
5
1
77
40
5
0.83
1.2
5
1

Classes

Class Line # Actions
ServletApplicationContext 38 6 0% 5 4
0.636363663.6%
 

Contributing tests

No tests hitting this source file were found.

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.io.File;
23    import java.io.InputStream;
24    import java.net.MalformedURLException;
25    import java.net.URL;
26   
27    import javax.servlet.ServletContext;
28   
29    import org.slf4j.Logger;
30    import org.slf4j.LoggerFactory;
31    import org.xwiki.component.manager.ComponentManager;
32    import org.xwiki.container.AbstractApplicationContext;
33   
34    /**
35    * @deprecated starting with 3.5M1, use the notion of Environment instead
36    */
37    @Deprecated
 
38    public class ServletApplicationContext extends AbstractApplicationContext
39    {
40    /**
41    * The logger to log.
42    */
43    protected static final Logger LOGGER = LoggerFactory.getLogger(ServletApplicationContext.class);
44   
45    private final ServletContext servletContext;
46   
 
47  116 toggle public ServletApplicationContext(ServletContext servletContext, ComponentManager componentManager)
48    {
49  116 super(componentManager);
50   
51  116 this.servletContext = servletContext;
52    }
53   
 
54  32 toggle public ServletContext getServletContext()
55    {
56  32 return this.servletContext;
57    }
58   
 
59  32 toggle @Override
60    public InputStream getResourceAsStream(String resourceName)
61    {
62  32 return getServletContext().getResourceAsStream(resourceName);
63    }
64   
 
65  0 toggle @Override
66    public URL getResource(String resourceName) throws MalformedURLException
67    {
68  0 return getServletContext().getResource(resourceName);
69    }
70   
 
71  0 toggle @Override
72    public File getTemporaryDirectory()
73    {
74    // Section SRV.4.7.1 of the Servlet 2.5 specification says that this should be available.
75  0 return (File) this.servletContext.getAttribute("javax.servlet.context.tempdir");
76    }
77    }