View Javadoc
1   /**
2    * This Source Code Form is subject to the terms of the Mozilla Public
3    * License, v. 2.0. If a copy of the MPL was not distributed with this
4    * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5    *
6    * If it is not possible or desirable to put the notice in a particular
7    * file, then You may include the notice in a location (such as a LICENSE
8    * file in a relevant directory) where a recipient would be likely to look
9    * for such a notice.
10  
11   * 
12   */
13   
14  /*  ---------------------------------------------------------------------------
15   *  U.S. Government, Department of the Army
16   *  Army Materiel Command
17   *  Research Development Engineering Command
18   *  Communications Electronics Research Development and Engineering Center
19   *  ---------------------------------------------------------------------------
20   */
21  package org.miloss.fgsms.test;
22  
23  import java.io.*;
24  import java.security.Principal;
25  import java.util.*;
26  import javax.servlet.*;
27  import javax.servlet.http.*;
28  
29  
30  /**
31   *
32   * @author AO
33   */
34  public class MyHttpServletRequest implements HttpServletRequest {
35  
36      public MyHttpServletRequest(String username) {
37          uname = username;
38      }
39      String url = "http://localhost:8180/fgsmsServices/DCS";
40  
41      public MyHttpServletRequest(String username, String requesturl) {
42          uname = username;
43          url = requesturl;
44      }
45  
46      public String getAuthType() {
47          return "Basic";
48      }
49  
50      public Cookie[] getCookies() {
51          return null;
52      }
53  
54      public long getDateHeader(String string) {
55          return 0;
56      }
57  
58      public String getHeader(String string) {
59          return null;
60      }
61  
62      public Enumeration<String> getHeaders(String string) {
63          return null;
64      }
65  
66      public Enumeration<String> getHeaderNames() {
67          return null;
68      }
69  
70      public int getIntHeader(String string) {
71          return 200;
72      }
73  
74      public String getMethod() {
75          return "POST";
76      }
77  
78      public String getPathInfo() {
79          return null;
80      }
81  
82      public String getPathTranslated() {
83          return null;
84      }
85  
86      public String getContextPath() {
87          return null;
88      }
89  
90      public String getQueryString() {
91          return null;
92      }
93      private String uname = "";
94  
95      public String getRemoteUser() {
96          return uname;
97      }
98  
99      public boolean isUserInRole(String string) {
100         return false;
101     }
102 
103     public Principal getUserPrincipal() {
104         return new SimplePrincipal(uname);
105     }
106 
107     public String getRequestedSessionId() {
108         throw new UnsupportedOperationException("Not supported yet.");
109     }
110 
111     public String getRequestURI() {
112         return url;
113     }
114 
115     public StringBuffer getRequestURL() {
116         throw new UnsupportedOperationException("Not supported yet.");
117     }
118 
119     public String getServletPath() {
120         throw new UnsupportedOperationException("Not supported yet.");
121     }
122 
123     public HttpSession getSession(boolean bln) {
124         throw new UnsupportedOperationException("Not supported yet.");
125     }
126 
127     public HttpSession getSession() {
128         throw new UnsupportedOperationException("Not supported yet.");
129     }
130 
131     public boolean isRequestedSessionIdValid() {
132         throw new UnsupportedOperationException("Not supported yet.");
133     }
134 
135     public boolean isRequestedSessionIdFromCookie() {
136         throw new UnsupportedOperationException("Not supported yet.");
137     }
138 
139     public boolean isRequestedSessionIdFromURL() {
140         throw new UnsupportedOperationException("Not supported yet.");
141     }
142 
143     public boolean isRequestedSessionIdFromUrl() {
144         throw new UnsupportedOperationException("Not supported yet.");
145     }
146 
147     public boolean authenticate(HttpServletResponse hsr) throws IOException, ServletException {
148         throw new UnsupportedOperationException("Not supported yet.");
149     }
150 
151     public void login(String string, String string1) throws ServletException {
152         throw new UnsupportedOperationException("Not supported yet.");
153     }
154 
155     public void logout() throws ServletException {
156         throw new UnsupportedOperationException("Not supported yet.");
157     }
158 
159     public Collection<Part> getParts() throws IOException, ServletException {
160         throw new UnsupportedOperationException("Not supported yet.");
161     }
162 
163     public Part getPart(String string) throws IOException, ServletException {
164         throw new UnsupportedOperationException("Not supported yet.");
165     }
166 
167     public Object getAttribute(String string) {
168         throw new UnsupportedOperationException("Not supported yet.");
169     }
170 
171     public Enumeration<String> getAttributeNames() {
172         throw new UnsupportedOperationException("Not supported yet.");
173     }
174 
175     public String getCharacterEncoding() {
176         throw new UnsupportedOperationException("Not supported yet.");
177     }
178 
179     public void setCharacterEncoding(String string) throws UnsupportedEncodingException {
180         throw new UnsupportedOperationException("Not supported yet.");
181     }
182 
183     public int getContentLength() {
184         throw new UnsupportedOperationException("Not supported yet.");
185     }
186 
187     public String getContentType() {
188         throw new UnsupportedOperationException("Not supported yet.");
189     }
190 
191     public ServletInputStream getInputStream() throws IOException {
192         return null;
193     }
194 
195     public String getParameter(String string) {
196         return null;
197     }
198 
199     public Enumeration<String> getParameterNames() {
200         return null;
201     }
202 
203     public String[] getParameterValues(String string) {
204         return null;
205     }
206 
207     public Map<String, String[]> getParameterMap() {
208         return null;
209     }
210 
211     public String getProtocol() {
212         return null;
213     }
214 
215     public String getScheme() {
216         return null;
217     }
218 
219     public String getServerName() {
220         return null;
221     }
222 
223     public int getServerPort() {
224         return 8180;
225     }
226 
227     public BufferedReader getReader() throws IOException {
228         throw new UnsupportedOperationException("Not supported yet.");
229     }
230 
231     public String getRemoteAddr() {
232         return "127.0.0.1";
233     }
234 
235     public String getRemoteHost() {
236         return "fgsmsdev1";
237     }
238 
239     public void setAttribute(String string, Object o) {
240     }
241 
242     public void removeAttribute(String string) {
243     }
244 
245     public Locale getLocale() {
246         return null;
247     }
248 
249     public Enumeration<Locale> getLocales() {
250         return null;
251     }
252 
253     public boolean isSecure() {
254         return false;
255     }
256 
257     public RequestDispatcher getRequestDispatcher(String string) {
258         return null;
259     }
260 
261     public String getRealPath(String string) {
262         return null;
263     }
264 
265     public int getRemotePort() {
266         return 12345;
267     }
268 
269     public String getLocalName() {
270         return null;
271     }
272 
273     public String getLocalAddr() {
274         return null;
275     }
276 
277     public int getLocalPort() {
278         return 8180;
279     }
280 
281     public ServletContext getServletContext() {
282         return null;
283     }
284 
285     public AsyncContext startAsync() throws IllegalStateException {
286         return null;
287     }
288 
289     public AsyncContext startAsync(ServletRequest sr, ServletResponse sr1) throws IllegalStateException {
290         return null;
291     }
292 
293     public boolean isAsyncStarted() {
294         return false;
295     }
296 
297     public boolean isAsyncSupported() {
298         return false;
299     }
300 
301     public AsyncContext getAsyncContext() {
302         return null;
303     }
304 
305     public DispatcherType getDispatcherType() {
306         return null;
307     }
308 
309      @Override
310      public String changeSessionId() {
311           throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
312      }
313 
314      @Override
315      public <T extends HttpUpgradeHandler> T upgrade(Class<T> type) throws IOException, ServletException {
316           throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
317      }
318 
319      @Override
320      public long getContentLengthLong() {
321           throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
322      }
323 }