2 * ============LICENSE_START=======================================================
3 * ONAP : ccsdk features
4 * ================================================================================
5 * Copyright (C) 2021 highstreet technologies GmbH Intellectual Property.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.ccsdk.features.sdnr.wt.oauthprovider.http;
24 import java.io.BufferedReader;
25 import java.io.IOException;
26 import java.io.UnsupportedEncodingException;
27 import java.security.Principal;
28 import java.util.Collection;
29 import java.util.Enumeration;
30 import java.util.Locale;
32 import javax.servlet.AsyncContext;
33 import javax.servlet.DispatcherType;
34 import javax.servlet.RequestDispatcher;
35 import javax.servlet.ServletContext;
36 import javax.servlet.ServletException;
37 import javax.servlet.ServletInputStream;
38 import javax.servlet.ServletRequest;
39 import javax.servlet.ServletResponse;
40 import javax.servlet.http.Cookie;
41 import javax.servlet.http.HttpServletRequest;
42 import javax.servlet.http.HttpServletResponse;
43 import javax.servlet.http.HttpSession;
44 import javax.servlet.http.HttpUpgradeHandler;
45 import javax.servlet.http.Part;
47 public class HeadersOnlyHttpServletRequest implements HttpServletRequest{
49 private final Map<String,String> headers;
51 public HeadersOnlyHttpServletRequest(Map<String,String> headers) {
52 this.headers = headers;
55 public Object getAttribute(String name) {
56 // TODO Auto-generated method stub
61 public Enumeration<String> getAttributeNames() {
62 // TODO Auto-generated method stub
67 public String getCharacterEncoding() {
68 // TODO Auto-generated method stub
73 public void setCharacterEncoding(String env) throws UnsupportedEncodingException {
74 // TODO Auto-generated method stub
79 public int getContentLength() {
80 // TODO Auto-generated method stub
85 public long getContentLengthLong() {
86 // TODO Auto-generated method stub
91 public String getContentType() {
92 // TODO Auto-generated method stub
97 public ServletInputStream getInputStream() throws IOException {
98 // TODO Auto-generated method stub
103 public String getParameter(String name) {
104 // TODO Auto-generated method stub
109 public Enumeration<String> getParameterNames() {
110 // TODO Auto-generated method stub
115 public String[] getParameterValues(String name) {
116 // TODO Auto-generated method stub
121 public Map<String, String[]> getParameterMap() {
122 // TODO Auto-generated method stub
127 public String getProtocol() {
128 // TODO Auto-generated method stub
133 public String getScheme() {
134 // TODO Auto-generated method stub
139 public String getServerName() {
140 // TODO Auto-generated method stub
145 public int getServerPort() {
146 // TODO Auto-generated method stub
151 public BufferedReader getReader() throws IOException {
152 // TODO Auto-generated method stub
157 public String getRemoteAddr() {
158 // TODO Auto-generated method stub
163 public String getRemoteHost() {
164 // TODO Auto-generated method stub
169 public void setAttribute(String name, Object o) {
170 // TODO Auto-generated method stub
175 public void removeAttribute(String name) {
176 // TODO Auto-generated method stub
181 public Locale getLocale() {
182 // TODO Auto-generated method stub
187 public Enumeration<Locale> getLocales() {
188 // TODO Auto-generated method stub
193 public boolean isSecure() {
194 // TODO Auto-generated method stub
199 public RequestDispatcher getRequestDispatcher(String path) {
200 // TODO Auto-generated method stub
205 public String getRealPath(String path) {
206 // TODO Auto-generated method stub
211 public int getRemotePort() {
212 // TODO Auto-generated method stub
217 public String getLocalName() {
218 // TODO Auto-generated method stub
223 public String getLocalAddr() {
224 // TODO Auto-generated method stub
229 public int getLocalPort() {
230 // TODO Auto-generated method stub
235 public ServletContext getServletContext() {
236 // TODO Auto-generated method stub
241 public AsyncContext startAsync() throws IllegalStateException {
242 // TODO Auto-generated method stub
247 public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
248 throws IllegalStateException {
249 // TODO Auto-generated method stub
254 public boolean isAsyncStarted() {
255 // TODO Auto-generated method stub
260 public boolean isAsyncSupported() {
261 // TODO Auto-generated method stub
266 public AsyncContext getAsyncContext() {
267 // TODO Auto-generated method stub
272 public DispatcherType getDispatcherType() {
273 // TODO Auto-generated method stub
278 public String getAuthType() {
279 // TODO Auto-generated method stub
284 public Cookie[] getCookies() {
285 // TODO Auto-generated method stub
290 public long getDateHeader(String name) {
291 // TODO Auto-generated method stub
296 public String getHeader(String name) {
297 return this.headers.getOrDefault(name,null);
301 public Enumeration<String> getHeaders(String name) {
302 // TODO Auto-generated method stub
307 public Enumeration<String> getHeaderNames() {
308 // TODO Auto-generated method stub
313 public int getIntHeader(String name) {
314 // TODO Auto-generated method stub
319 public String getMethod() {
320 // TODO Auto-generated method stub
325 public String getPathInfo() {
326 // TODO Auto-generated method stub
331 public String getPathTranslated() {
332 // TODO Auto-generated method stub
337 public String getContextPath() {
338 // TODO Auto-generated method stub
343 public String getQueryString() {
344 // TODO Auto-generated method stub
349 public String getRemoteUser() {
350 // TODO Auto-generated method stub
355 public boolean isUserInRole(String role) {
356 // TODO Auto-generated method stub
361 public Principal getUserPrincipal() {
362 // TODO Auto-generated method stub
367 public String getRequestedSessionId() {
368 // TODO Auto-generated method stub
373 public String getRequestURI() {
374 // TODO Auto-generated method stub
379 public StringBuffer getRequestURL() {
380 // TODO Auto-generated method stub
385 public String getServletPath() {
386 // TODO Auto-generated method stub
391 public HttpSession getSession(boolean create) {
392 // TODO Auto-generated method stub
397 public HttpSession getSession() {
398 // TODO Auto-generated method stub
403 public String changeSessionId() {
404 // TODO Auto-generated method stub
409 public boolean isRequestedSessionIdValid() {
410 // TODO Auto-generated method stub
415 public boolean isRequestedSessionIdFromCookie() {
416 // TODO Auto-generated method stub
421 public boolean isRequestedSessionIdFromURL() {
422 // TODO Auto-generated method stub
427 public boolean isRequestedSessionIdFromUrl() {
428 // TODO Auto-generated method stub
433 public boolean authenticate(HttpServletResponse response) throws IOException, ServletException {
434 // TODO Auto-generated method stub
439 public void login(String username, String password) throws ServletException {
440 // TODO Auto-generated method stub
445 public void logout() throws ServletException {
446 // TODO Auto-generated method stub
451 public Collection<Part> getParts() throws IOException, ServletException {
452 // TODO Auto-generated method stub
457 public Part getPart(String name) throws IOException, ServletException {
458 // TODO Auto-generated method stub
463 public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException {
464 // TODO Auto-generated method stub