1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package com.xpn.xwiki.web

File XWikiServletResponseStub.java

 

Coverage histogram

../../../../img/srcFileCovDistChart3.png
82% of files have more coverage

Code metrics

2
20
40
1
264
196
41
2.05
0.5
40
1.02

Classes

Class Line # Actions
XWikiServletResponseStub 38 20 0% 41 46
0.258064525.8%
 

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 com.xpn.xwiki.web;
21   
22    import java.io.IOException;
23    import java.io.OutputStream;
24    import java.io.PrintWriter;
25    import java.util.Collection;
26    import java.util.Locale;
27   
28    import javax.servlet.ServletOutputStream;
29    import javax.servlet.http.Cookie;
30    import javax.servlet.http.HttpServletResponse;
31   
32    /**
33    * This stub is intended to simulate a servlet request in a daemon context, in order to be able to create a custom XWiki
34    * context. This trick is used in to give a daemon thread access to the XWiki api.
35    *
36    * @version $Id: 933e43b755080fdcf8df9734a97ba866897a0a62 $
37    */
 
38    public class XWikiServletResponseStub implements XWikiResponse
39    {
40    private OutputStream outputStream;
41   
42    private ServletOutputStream servletOutputStream = new ServletOutputStream()
43    {
 
44  777062 toggle @Override
45    public void write(int b) throws IOException
46    {
47  777062 if (XWikiServletResponseStub.this.outputStream != null) {
48  777062 XWikiServletResponseStub.this.outputStream.write(b);
49    }
50    }
51    };
52   
 
53  48 toggle public void setOutpuStream(OutputStream outputStream)
54    {
55  48 this.outputStream = outputStream;
56    }
57   
 
58  0 toggle @Override
59    public HttpServletResponse getHttpServletResponse()
60    {
61  0 return null;
62    }
63   
 
64  46 toggle @Override
65    public void setCharacterEncoding(String s)
66    {
67    }
68   
 
69  0 toggle @Override
70    public void removeCookie(String cookieName, XWikiRequest request)
71    {
72    }
73   
 
74  0 toggle @Override
75    public void addCookie(Cookie cookie)
76    {
77    }
78   
 
79  0 toggle @Override
80    public boolean containsHeader(String name)
81    {
82  0 return false;
83    }
84   
 
85  97636 toggle @Override
86    public String encodeURL(String url)
87    {
88  97768 return url;
89    }
90   
 
91  0 toggle @Override
92    public String encodeRedirectURL(String url)
93    {
94  0 return url;
95    }
96   
 
97  0 toggle @Override
98    public String encodeUrl(String url)
99    {
100  0 return url;
101    }
102   
 
103  0 toggle @Override
104    public String encodeRedirectUrl(String url)
105    {
106  0 return url;
107    }
108   
 
109  0 toggle @Override
110    public void sendError(int sc, String msg) throws IOException
111    {
112    }
113   
 
114  0 toggle @Override
115    public void sendError(int sc) throws IOException
116    {
117    }
118   
 
119  0 toggle @Override
120    public void sendRedirect(String location) throws IOException
121    {
122    }
123   
 
124  96 toggle @Override
125    public void setDateHeader(String name, long date)
126    {
127    }
128   
 
129  0 toggle @Override
130    public void addDateHeader(String name, long date)
131    {
132    }
133   
 
134  48 toggle @Override
135    public void setHeader(String name, String value)
136    {
137    }
138   
 
139  0 toggle @Override
140    public void addHeader(String name, String value)
141    {
142    }
143   
 
144  0 toggle @Override
145    public void setIntHeader(String name, int value)
146    {
147    }
148   
 
149  0 toggle @Override
150    public void addIntHeader(String name, int value)
151    {
152    }
153   
 
154  0 toggle @Override
155    public void setStatus(int sc)
156    {
157    }
158   
 
159  0 toggle @Override
160    public void setStatus(int sc, String sm)
161    {
162    }
163   
 
164  0 toggle @Override
165    public String getCharacterEncoding()
166    {
167  0 return null;
168    }
169   
 
170  0 toggle @Override
171    public String getContentType()
172    {
173  0 return null;
174    }
175   
 
176  48 toggle @Override
177    public ServletOutputStream getOutputStream() throws IOException
178    {
179  48 return this.servletOutputStream;
180    }
181   
 
182  0 toggle @Override
183    public PrintWriter getWriter() throws IOException
184    {
185  0 return null;
186    }
187   
 
188  48 toggle @Override
189    public void setContentLength(int len)
190    {
191    }
192   
 
193  48 toggle @Override
194    public void setContentType(String type)
195    {
196    }
197   
 
198  0 toggle @Override
199    public void setBufferSize(int size)
200    {
201    }
202   
 
203  0 toggle @Override
204    public int getBufferSize()
205    {
206  0 return 0;
207    }
208   
 
209  0 toggle @Override
210    public void flushBuffer() throws IOException
211    {
212    }
213   
 
214  0 toggle @Override
215    public void resetBuffer()
216    {
217    }
218   
 
219  0 toggle @Override
220    public boolean isCommitted()
221    {
222  0 return false;
223    }
224   
 
225  0 toggle @Override
226    public void reset()
227    {
228    }
229   
 
230  26 toggle @Override
231    public void setLocale(Locale loc)
232    {
233    }
234   
 
235  0 toggle @Override
236    public Locale getLocale()
237    {
238  0 return null;
239    }
240   
 
241  0 toggle @Override
242    public int getStatus()
243    {
244  0 return 0;
245    }
246   
 
247  0 toggle @Override
248    public String getHeader(String s)
249    {
250  0 return null;
251    }
252   
 
253  0 toggle @Override
254    public Collection<String> getHeaders(String s)
255    {
256  0 return null;
257    }
258   
 
259  0 toggle @Override
260    public Collection<String> getHeaderNames()
261    {
262  0 return null;
263    }
264    }