1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * ===========================================================================
\r
7 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * * you may not use this file except in compliance with the License.
\r
9 * * You may obtain a copy of the License at
\r
11 * * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * * Unless required by applicable law or agreed to in writing, software
\r
14 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * * See the License for the specific language governing permissions and
\r
17 * * limitations under the License.
\r
18 * * ============LICENSE_END====================================================
\r
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package com.att.cadi;
\r
25 import java.io.BufferedReader;
\r
26 import java.io.IOException;
\r
27 import java.io.InputStreamReader;
\r
29 import javax.servlet.http.HttpServletRequest;
\r
32 * BufferedCadiWrap exists to additionally wrap the InputStream with a BufferedInputStream to engage the
\r
33 * "mark()/release()" API of InputStream.
\r
35 * This is a requirement for Re-Reading Content for brain-dead Middleware such as SOAP WS-Security.
\r
37 * Framework needs to set the TafResp and Lur (typically) later in the
\r
41 public class BufferedCadiWrap extends CadiWrap {
\r
42 private BufferedServletInputStream sis;
\r
44 public BufferedCadiWrap(HttpServletRequest request) {
\r
45 super(request, null, null); // will need to set TafResp and Lur separately
\r
51 public BufferedServletInputStream getInputStream() throws IOException {
\r
52 // System.out.println("getInputStream() from Buffered CadiWrap... sis = " + sis);
\r
54 // throw new Exception("OK, here's where we are...");
\r
55 // } catch (Exception e) {
\r
56 // e.printStackTrace();
\r
59 sis = new BufferedServletInputStream(super.getInputStream());
\r
62 // System.out.println("sis has " + sis.buffered() + " buffered bytes, and reports " + sis.available() + " available");
\r
63 // } catch (Exception e) {
\r
64 // e.printStackTrace();
\r
71 public BufferedReader getReader() throws IOException {
\r
72 // System.out.println("getReader() from Buffered CadiWrap... sis = " + sis);
\r
74 // throw new Exception("OK, here's where we are...");
\r
75 // } catch (Exception e) {
\r
76 // e.printStackTrace();
\r
78 return new BufferedReader(new InputStreamReader(getInputStream()));
\r