/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/SRTServletRequest.java

https://github.com/OpenLiberty/open-liberty · Java · 4291 lines · 3144 code · 439 blank · 708 comment · 845 complexity · 535d149bfe2f4bceb665d9b5d571486d MD5 · raw file

  1. /*******************************************************************************
  2. * Copyright (c) 1997, 2008 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * IBM Corporation - initial API and implementation
  10. *******************************************************************************/
  11. package com.ibm.ws.webcontainer.srt;
  12. import java.io.BufferedReader;
  13. import java.io.ByteArrayInputStream;
  14. import java.io.File;
  15. import java.io.IOException;
  16. import java.io.InputStream;
  17. import java.io.InputStreamReader;
  18. import java.io.UnsupportedEncodingException;
  19. import java.lang.reflect.Method;
  20. import java.net.InetAddress;
  21. import java.security.AccessController;
  22. import java.security.Principal;
  23. import java.security.PrivilegedActionException;
  24. import java.security.cert.X509Certificate;
  25. import java.text.MessageFormat;
  26. import java.util.ArrayList;
  27. import java.util.Collection;
  28. import java.util.Collections;
  29. import java.util.Enumeration;
  30. import java.util.HashMap;
  31. import java.util.HashSet;
  32. import java.util.Hashtable;
  33. import java.util.Iterator;
  34. import java.util.LinkedHashMap;
  35. import java.util.LinkedList;
  36. import java.util.List;
  37. import java.util.Locale;
  38. import java.util.Map;
  39. import java.util.StringTokenizer;
  40. import java.util.Vector;
  41. import java.util.logging.Level;
  42. import java.util.logging.Logger;
  43. import javax.servlet.AsyncContext;
  44. import javax.servlet.DispatcherType;
  45. import javax.servlet.MultipartConfigElement;
  46. import javax.servlet.RequestDispatcher;
  47. import javax.servlet.ServletContext;
  48. import javax.servlet.ServletException;
  49. import javax.servlet.ServletInputStream;
  50. import javax.servlet.ServletRequest;
  51. import javax.servlet.ServletResponse;
  52. import javax.servlet.http.Cookie;
  53. import javax.servlet.http.HttpServletRequest;
  54. import javax.servlet.http.HttpServletResponse;
  55. import javax.servlet.http.HttpSession;
  56. import javax.servlet.http.Part;
  57. import org.apache.commons.fileupload.FileUploadBase.FileSizeLimitExceededException;
  58. import org.apache.commons.fileupload.FileUploadBase.SizeLimitExceededException;
  59. import org.apache.commons.fileupload.FileUploadException;
  60. import org.apache.commons.fileupload.disk.DiskFileItem;
  61. import org.apache.commons.fileupload.disk.DiskFileItemFactory;
  62. import org.apache.commons.fileupload.servlet.ServletFileUpload;
  63. import com.ibm.ejs.ras.TraceNLS;
  64. import com.ibm.websphere.ras.TraceComponent;
  65. import com.ibm.websphere.servlet.request.IRequest;
  66. import com.ibm.websphere.servlet.response.IResponse;
  67. import com.ibm.ws.genericbnf.PasswordNullifier;
  68. import com.ibm.ws.http.channel.inputstream.HttpInputStreamObserver;
  69. import com.ibm.ws.session.utils.IDGeneratorImpl;
  70. import com.ibm.ws.webcontainer.async.AsyncContextImpl;
  71. import com.ibm.ws.webcontainer.async.AsyncIllegalStateException;
  72. import com.ibm.ws.webcontainer.async.AsyncListenerEntry;
  73. import com.ibm.ws.webcontainer.internalRuntimeExport.srt.IPrivateRequestAttributes;
  74. import com.ibm.ws.webcontainer.osgi.collaborator.CollaboratorHelperImpl;
  75. import com.ibm.ws.webcontainer.servlet.RequestUtils;
  76. import com.ibm.ws.webcontainer.session.SessionManagerConfigBase;
  77. import com.ibm.ws.webcontainer.util.EmptyEnumeration;
  78. import com.ibm.ws.webcontainer.util.UnsynchronizedStack;
  79. import com.ibm.ws.webcontainer.webapp.WebApp;
  80. import com.ibm.ws.webcontainer.webapp.WebAppConfiguration;
  81. import com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext;
  82. import com.ibm.ws.webcontainer.webapp.WebGroup;
  83. import com.ibm.wsspi.webcontainer.IPoolable;
  84. import com.ibm.wsspi.webcontainer.WCCustomProperties;
  85. import com.ibm.wsspi.webcontainer.WebContainer;
  86. import com.ibm.wsspi.webcontainer.WebContainerConstants;
  87. import com.ibm.wsspi.webcontainer.WebContainerRequestState;
  88. import com.ibm.wsspi.webcontainer.collaborator.IWebAppSecurityCollaborator;
  89. import com.ibm.wsspi.webcontainer.logging.LoggerFactory;
  90. import com.ibm.wsspi.webcontainer.servlet.IExtendedRequest;
  91. import com.ibm.wsspi.webcontainer.servlet.IExtendedResponse;
  92. import com.ibm.wsspi.webcontainer.servlet.IServletConfig;
  93. import com.ibm.wsspi.webcontainer.servlet.IServletRequest;
  94. import com.ibm.wsspi.webcontainer.servlet.ServletRequestExtended;
  95. import com.ibm.wsspi.webcontainer.util.EncodingUtils;
  96. import com.ibm.wsspi.webcontainer.util.IInputStreamObserver;
  97. import com.ibm.wsspi.webcontainer.util.WSServletInputStream;
  98. import com.ibm.wsspi.webcontainer.webapp.IWebAppDispatcherContext;
  99. @SuppressWarnings("unchecked")
  100. public class SRTServletRequest implements HttpServletRequest, IExtendedRequest, IServletRequest, IPrivateRequestAttributes, IInputStreamObserver, ServletRequestExtended, HttpInputStreamObserver
  101. {
  102. // Class level objects
  103. // =========================
  104. protected static final Logger logger = LoggerFactory.getInstance().getLogger("com.ibm.ws.webcontainer.srt");
  105. private static final String CLASS_NAME="com.ibm.ws.webcontainer.srt.SRTServletRequest";
  106. protected static final TraceNLS nls = TraceNLS.getTraceNLS(SRTServletRequest.class, "com.ibm.ws.webcontainer.resources.Messages");
  107. protected static final TraceNLS liberty_nls = TraceNLS.getTraceNLS(SRTServletRequest.class, "com.ibm.ws.webcontainer.resources.LShimMessages");
  108. private static String CLIENT_ENCODING_OVERRIDE;
  109. private static String DEFAULT_CLIENT_ENCODING;
  110. private static String suppressHeadersInRequest = null; // PK80362
  111. private static ArrayList suppressheadersList = null; // PK80362
  112. static {
  113. // 115780 - begin - get static references to the default and override encodings
  114. CLIENT_ENCODING_OVERRIDE = System.getProperty("client.encoding.override");
  115. DEFAULT_CLIENT_ENCODING = System.getProperty("default.client.encoding");
  116. // 115780 - end
  117. // PK80362 Start
  118. suppressHeadersInRequest = WCCustomProperties.SUPPRESS_HEADERS_IN_REQUEST;
  119. if (suppressHeadersInRequest != null){
  120. String delimiter = ",";
  121. suppressheadersList = new ArrayList();
  122. StringTokenizer st = new StringTokenizer(suppressHeadersInRequest, delimiter);
  123. while(st.hasMoreTokens()) {
  124. suppressheadersList.add(st.nextToken().trim());
  125. }
  126. }// PK80362 End
  127. }
  128. private static final String JAVAX_NET_SSL_PEER_CERTS = "javax.net.ssl.peer_certificates";
  129. private static final String JAVAX_NET_SSL_CIPHER_SUITE = "javax.net.ssl.cipher_suite";
  130. private static final String JAVAX_SERVLET_REQUEST_X509CERTIFICATE = "javax.servlet.request.X509Certificate";
  131. private static final String DIRECT_CONNECTION_PEER_CERTS = "com.ibm.websphere.ssl.direct_connection_peer_certificates";
  132. private static final String DIRECT_CONNECTION_CIPHER_SUITE = "com.ibm.websphere.ssl.direct_connection_cipher_suite";
  133. private static final String IS_DIRECT_CONNECTION = "com.ibm.websphere.webcontainer.is_direct_connection"; //F001872
  134. protected static final String INPUT_STREAM_CONTENT_TYPE = "ContentType"; // PK57679
  135. protected static final String INPUT_STREAM_CONTENT_DATA = "ContentData"; // PK57679
  136. protected static final String INPUT_STREAM_CONTENT_DATA_LENGTH = "ContentDataLength"; // 516233
  137. // =========================
  138. // Objects requiring Cloning
  139. // =========================
  140. // 268366, PERF: 3% regression in PingServlet, create paramStack only one since parameters are popped off after usage
  141. private UnsynchronizedStack _paramStack = new UnsynchronizedStack();
  142. // Created once in Constructor of SRTServletRequest object and not recreated for each request.
  143. protected SRTConnectionContext _connContext;
  144. protected SRTRequestContext _requestContext = null;
  145. // set prior to handle the current dispatch to resource
  146. protected WebAppDispatcherContext _dispatchContext = null;
  147. protected SRTServletRequestHelper _srtRequestHelper; // keep all per request objects in this helper class since SRTServletRequest objects are reused.
  148. protected static final int LENGTH_INT = 4;
  149. protected static final int LENGTH_LONG = 8;
  150. protected static final int OFFSET_CONTENT_DATA_LENGTH = 0;
  151. protected static final int OFFSET_CONTENT_TYPE_LEN = 1;
  152. protected static final int OFFSET_CONTENT_TYPE_DATA = 2;
  153. protected static final int OFFSET_CONTENT_DATA = 3;
  154. // ========================= Following required for MultiRead
  155. protected boolean multiReadPropertyEnabled = false;
  156. protected boolean httpUpdatedwMultiReadValues = false;
  157. //=========================
  158. // Objects not requiring Cloning
  159. // =========================
  160. // reset on each call to initForNextRequest
  161. protected IRequest _request = null;
  162. // protected HttpInputStream _in = new HttpInputStream();
  163. protected WSServletInputStream _in;
  164. private boolean _runningCollaborators = false; // PK01801
  165. protected String _setInputStreamContentType; // PK57679
  166. protected long _setInputStreamContentLength; // PK57679
  167. protected boolean _setInputDataStreamCalled; // 5166233
  168. // =========================
  169. // WARNING! This custom property has not been officially exposed in an APAR
  170. // This was added as a way to revert back to pre-Servlet 2.5 changes.
  171. // If level 2 wishes to devulge this info, level 3 should be informed. Thanks!
  172. private static final boolean enableSetCharacterEncodingAfterGetReader = (Boolean.valueOf(WebContainer.getWebContainerProperties().getProperty("enablesetcharacterencodingaftergetreader"))).booleanValue();
  173. //PM03928
  174. private static boolean disableSetCharacterEncodingAfterParametersRead = WCCustomProperties.DISABLE_SET_CHARACTER_ENCODING_AFTER_PARAMETERS_READ;
  175. //PM92496, moved from ServletWrapper
  176. private static boolean keySizeFromCipherMap =
  177. Boolean.valueOf(WebContainer.getWebContainerProperties().getProperty("com.ibm.ws.webcontainer.keysizefromciphermap", "true")).booleanValue(); //not exposed in Infocenter
  178. // 721610 (PM51389)
  179. //PI43752 start
  180. private boolean usedStartAsyncNoParameters = false;
  181. //PI43752 end
  182. protected static final boolean SERVLET_PATH_FOR_DEFAULT_MAPPING = Boolean.valueOf(WCCustomProperties.SERVLET_PATH_FOR_DEFAULT_MAPPING).booleanValue();
  183. public SRTServletRequest(SRTConnectionContext context)
  184. {
  185. this._connContext = context;
  186. this._requestContext = new SRTRequestContext(this);
  187. this._in = createInputStream();
  188. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  189. logger.logp(Level.FINE, CLASS_NAME,"SRTServletRequest", "this->"+this+": " + "inputStream is of type --> " + this._in);
  190. }
  191. }
  192. protected SRTServletRequest() {
  193. // used only for cloning
  194. }
  195. public Object getPrivateAttribute(String name) {
  196. // 321485
  197. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  198. logger.logp(Level.FINE, CLASS_NAME,"getPrivateAttribute", "this->"+this+": "+" name --> " + name);
  199. }
  200. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  201. checkRequestObjectInUse();
  202. }
  203. if (_srtRequestHelper._privateAttributes == null)
  204. return null;
  205. return _srtRequestHelper._privateAttributes.get(name);
  206. }
  207. protected void checkRequestObjectInUse() {
  208. WebContainerRequestState reqState = WebContainerRequestState.getInstance(true);
  209. IExtendedRequest curThreadIExtendedReq = reqState.getCurrentThreadsIExtendedRequest();
  210. if (curThreadIExtendedReq!=null&&curThreadIExtendedReq!=this){
  211. try
  212. {
  213. throw new IllegalStateException("Wrong request object in use on Thread");
  214. } catch (IllegalStateException e) {
  215. //No need to NLS these since they're only printed out for IBM service use when a custom property is on.
  216. logger.logp(Level.SEVERE,CLASS_NAME,"checkRequestObjectInUse","ERROR: Wrong request object in use on Thread. Object Expected: "
  217. +curThreadIExtendedReq+", Found: "+this);
  218. logger.logp(Level.SEVERE,CLASS_NAME,"checkRequestObjectInUse","Wrong request object in use on Thread. \n", e);
  219. }
  220. }
  221. }
  222. public Enumeration getPrivateAttributeNames() {
  223. // 321485
  224. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  225. logger.logp(Level.FINE, CLASS_NAME,"getPrivateAttributeNames", "this->"+this+": ");
  226. }
  227. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  228. checkRequestObjectInUse();
  229. }
  230. if (_srtRequestHelper._privateAttributes == null)
  231. return EmptyEnumeration.instance();
  232. return _srtRequestHelper._privateAttributes.keys();
  233. }
  234. public void setPrivateAttribute(String name, Object value) {
  235. // 321485
  236. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  237. logger.logp(Level.FINE, CLASS_NAME,"setPrivateAttribute", "this->"+this+": "+" name --> " + name + " value --> " + value.toString());
  238. }
  239. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  240. checkRequestObjectInUse();
  241. }
  242. if (_srtRequestHelper._privateAttributes == null)
  243. _srtRequestHelper._privateAttributes = new Hashtable();
  244. _srtRequestHelper._privateAttributes.put(name, value);
  245. }
  246. public void removePrivateAttribute(String name) {
  247. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  248. logger.logp(Level.FINE, CLASS_NAME,"removePrivateAttribute", "this->"+this+": "+" name --> " + name);
  249. }
  250. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  251. checkRequestObjectInUse();
  252. }
  253. if (_srtRequestHelper._privateAttributes != null)
  254. _srtRequestHelper._privateAttributes.remove(name);
  255. }
  256. /**
  257. * @param conn com.ibm.servlet.engine.srp.ISRPConnection
  258. */
  259. public void initForNextRequest(IRequest req) {
  260. // 321485
  261. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  262. logger.logp(Level.FINE, CLASS_NAME,"initForNextRequest", "this->"+this+": ");
  263. }
  264. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  265. checkRequestObjectInUse();
  266. }
  267. try {
  268. if (req == null) {
  269. // MultiRead Start
  270. if(this.multiReadPropertyEnabled) {
  271. if(this._in instanceof SRTInputStream) {
  272. ((SRTInputStream) this._in).cleanupforMultiRead();
  273. }
  274. multiReadPropertyEnabled = false;
  275. httpUpdatedwMultiReadValues = false;
  276. }// MultiRead End
  277. _in.init(null);
  278. return;
  279. }
  280. _setInputStreamContentType = null; // PK57679
  281. _setInputStreamContentLength = -1; // PK57679
  282. _setInputDataStreamCalled = false; // 516233
  283. this._request = req;
  284. _srtRequestHelper = getRequestHelper();
  285. SRTServletRequestThreadData.getInstance().init(null);
  286. _in.init(_request.getInputStream());
  287. // begin 280584.1 SVT: StackOverflowError when installing app larger than 2GB WAS.webcontainer
  288. if( this.getContentLength() > 0 ){
  289. _in.setContentLength(this.getContentLength());
  290. }
  291. // end 280584.1
  292. } catch (IOException e) {
  293. // shouldn't happen.
  294. com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(
  295. e,
  296. "com.ibm.ws.webcontainer.srt.SRTServletRequest.initForNextRequest",
  297. "828",
  298. this);
  299. //logger.logp(Level.SEVERE, CLASS_NAME,"initForNextRequest", "Error.Initializing.for.Next.Request", e);
  300. }
  301. }
  302. protected SRTServletRequestHelper getRequestHelper() {
  303. return new SRTServletRequestHelper();
  304. }
  305. // Helper method used by SRServletRequest31
  306. protected boolean getHelperGotReader() {
  307. return _srtRequestHelper._gotReader;
  308. }
  309. // Helper method used by SRServletRequest31
  310. protected void setHelperParameters(Map newParams) {
  311. SRTServletRequestThreadData.getInstance().setParameters(newParams);
  312. }
  313. /* (non-Javadoc)
  314. * @see javax.servlet.ServletRequest#getAttribute(java.lang.String)
  315. */
  316. public Object getAttribute(String arg0) {
  317. // 321485
  318. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  319. logger.logp(Level.FINE, CLASS_NAME,"getAttribute", "this->"+this+": "+" name --> " + arg0);
  320. }
  321. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  322. checkRequestObjectInUse();
  323. }
  324. Object obj = _srtRequestHelper._attributes.get(arg0);
  325. if (obj == null) {
  326. if (((WebAppDispatcherContext)getDispatchContext()).isSecurityEnabledForApplication()) {
  327. if (arg0.equalsIgnoreCase(JAVAX_NET_SSL_PEER_CERTS) ||
  328. arg0.equalsIgnoreCase(JAVAX_SERVLET_REQUEST_X509CERTIFICATE)) {
  329. obj = getPeerCertificates();
  330. } else if (arg0.equalsIgnoreCase(JAVAX_NET_SSL_CIPHER_SUITE)) {
  331. obj = getCipherSuite();
  332. } else if (arg0.equalsIgnoreCase(DIRECT_CONNECTION_PEER_CERTS)){
  333. obj = getDirectConnectionPeerCertificates();
  334. } else if (arg0.equalsIgnoreCase(DIRECT_CONNECTION_CIPHER_SUITE)){
  335. obj = getDirectConnectionCipherSuite();
  336. } else if (arg0.equalsIgnoreCase(IS_DIRECT_CONNECTION)){
  337. obj = isDirectConnection();
  338. } else if (arg0.equals(WebContainerConstants.JAVAX_SERVLET_REQUEST_SSL_SESSION_ID)){
  339. obj = this.getSSLSessionId();
  340. }
  341. }
  342. }
  343. return obj;
  344. }
  345. public Enumeration getAttributeNames() {
  346. // 321485
  347. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  348. logger.logp(Level.FINE, CLASS_NAME,"getAttributeNames", "this->"+this+": ");
  349. }
  350. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  351. checkRequestObjectInUse();
  352. }
  353. //PK81452- start
  354. if (WCCustomProperties.COPY_ATTRIBUTES_KEY_SET){
  355. return new Enumeration(){
  356. private java.util.Iterator iter = new ArrayList(_srtRequestHelper._attributes.keySet()).iterator();
  357. public boolean hasMoreElements() {
  358. return iter.hasNext();
  359. }
  360. public Object nextElement() {
  361. return iter.next();
  362. }
  363. };
  364. }
  365. else{
  366. return new Enumeration() {
  367. private java.util.Iterator iter = _srtRequestHelper._attributes.keySet().iterator();
  368. public boolean hasMoreElements() {
  369. return iter.hasNext();
  370. }
  371. public Object nextElement() {
  372. return iter.next();
  373. }
  374. };
  375. }
  376. }
  377. /* (non-Javadoc)
  378. * @see javax.servlet.ServletRequest#setCharacterEncoding(java.lang.String)
  379. */
  380. public void setCharacterEncoding(String arg0)
  381. throws UnsupportedEncodingException {
  382. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  383. checkRequestObjectInUse();
  384. }
  385. //321485
  386. if (!enableSetCharacterEncodingAfterGetReader){
  387. if (_srtRequestHelper._gotReader){//Servlet 2.5
  388. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  389. logger.logp(Level.FINE, CLASS_NAME,"setCharacterEncoding", "this->"+this+": "+" call ignored, already got reader");
  390. }
  391. return;
  392. }
  393. }
  394. //PM03928
  395. if (disableSetCharacterEncodingAfterParametersRead && _srtRequestHelper._parametersRead){
  396. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  397. logger.logp(Level.FINE, CLASS_NAME,"setCharacterEncoding", "this->"+this+": "+" name --> " + arg0 + " is ignored, already parsed data");
  398. }
  399. return;
  400. }
  401. //PM03928
  402. boolean isSupported = EncodingUtils.isCharsetSupported(arg0);
  403. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  404. logger.logp(Level.FINE, CLASS_NAME,"setCharacterEncoding", "this->"+this+": "+" name --> " + arg0 + " isSupported --> " + String.valueOf(isSupported));
  405. }
  406. if(isSupported){
  407. _srtRequestHelper._characterEncoding = arg0;
  408. }
  409. else{
  410. String msg = nls.getFormattedMessage("unsupported.request.encoding.[{0}]", new Object[] { arg0 }, "Unsupported encoding specified --> " + arg0);
  411. throw new UnsupportedEncodingException(msg);
  412. }
  413. }
  414. // PK80362 Start
  415. // Check if the header name needs to be suppressed provided in the header name list in custom property.
  416. // Returns true if header can be suppressed, or false if not.
  417. private boolean isHeaderinSuppressedHeadersList(String headername)
  418. {
  419. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  420. checkRequestObjectInUse();
  421. }
  422. boolean suppressHeader = false;
  423. if(headername != null){
  424. Iterator itList = suppressheadersList.iterator();
  425. while (itList.hasNext() && !(suppressHeader)) {
  426. String s = (String) itList.next();
  427. if (headername.startsWith(s)) {
  428. suppressHeader = true;
  429. if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE))
  430. logger.logp(Level.FINE, CLASS_NAME, "isHeaderinSuppressedHeadersList", " suppressHeadersInRequest is set and headername --> "+ headername +" begins with --> " + s);
  431. }
  432. }
  433. }
  434. return suppressHeader;
  435. }// PK80362 End
  436. /**
  437. * Returns the value of a date header field, or -1 if not found.
  438. * The case of the header field name is ignored.
  439. * @param name the case-insensitive header field name
  440. */
  441. public long getDateHeader(String name) {
  442. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  443. checkRequestObjectInUse();
  444. }
  445. // 321485
  446. // PK80362 Start
  447. // If the getDateHeader method cannot translate the header to a Date object, an IllegalArgumentException is thrown
  448. // long header = _request.getDateHeader(name);
  449. long header = -1;
  450. if ( (suppressHeadersInRequest == null) || !(isHeaderinSuppressedHeadersList(name))){
  451. header = _request.getDateHeader(name);
  452. }// PK80362 End
  453. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  454. logger.logp(Level.FINE, CLASS_NAME,"getDateHeader", "this->"+this+": "+" name --> " + name + " header --> " + String.valueOf(header));
  455. }
  456. return header;
  457. }
  458. /**
  459. * Returns the value of a header field, or null if not known.
  460. * The case of the header field name is ignored.
  461. * @param name the case-insensitive header field name
  462. */
  463. public String getHeader(String name) {
  464. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  465. checkRequestObjectInUse();
  466. }
  467. // 321485
  468. // PK80362 Start
  469. // String header = _request.getHeader(name);
  470. String header = null;
  471. if ( (suppressHeadersInRequest == null) || !(isHeaderinSuppressedHeadersList(name))){
  472. if (_request != null)
  473. header = _request.getHeader(name);
  474. }// PK80362 End
  475. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  476. logger.logp(Level.FINE, CLASS_NAME,"getHeader", "this->"+this+": "+" name --> " + name + " header --> " + PasswordNullifier.nullifyParams(header));
  477. }
  478. return header;
  479. }
  480. /**
  481. * 108037 - method added
  482. * Returns the value of a header field, or null if not known.
  483. * This method gets the header by going directly to the original
  484. * request object rather than init'ing the local headers. Created
  485. * for security performance
  486. *
  487. * @param name the case-sensitive header field name
  488. */
  489. public String getHeaderDirect(String name)
  490. {
  491. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  492. checkRequestObjectInUse();
  493. }
  494. // 321485
  495. // PK80362 Start
  496. // String header = _request.getHeader(name);
  497. String header = null;
  498. if ( (suppressHeadersInRequest == null) || !(isHeaderinSuppressedHeadersList(name))){
  499. header = _request.getHeader(name);
  500. }// PK80362 End
  501. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  502. logger.logp(Level.FINE, CLASS_NAME,"getHeaderDirect", "this->"+this+": "+" name --> " + name + " header --> " + header);
  503. }
  504. return header;
  505. }
  506. /**
  507. * Returns an enumeration of strings representing the header names
  508. * for this request. Some server implementations do not allow headers
  509. * to be accessed in this way, in which case this method will return null.
  510. */
  511. public Enumeration getHeaderNames() {
  512. // 321485
  513. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  514. logger.logp(Level.FINE, CLASS_NAME,"getHeaderNames", "this->"+this+": ");
  515. }
  516. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  517. checkRequestObjectInUse();
  518. }
  519. // PK80362 Start
  520. if( suppressHeadersInRequest == null){
  521. return _request.getHeaderNames();
  522. }
  523. else {// step through the existing enumeration and create a new one without header names listed in custom property
  524. ArrayList alHeaderNames = new ArrayList();
  525. Enumeration enumHeaderNames = _request.getHeaderNames();
  526. while( enumHeaderNames.hasMoreElements() ){
  527. String headerNameParam = (String) enumHeaderNames.nextElement();
  528. if (!(isHeaderinSuppressedHeadersList(headerNameParam)))
  529. alHeaderNames.add(headerNameParam);
  530. }
  531. return Collections.enumeration(alHeaderNames); // create new Enumeration
  532. }
  533. // return _request.getHeaderNames();
  534. // PK80362 End
  535. }
  536. /**
  537. * Returns the value of an integer header field, or -1 if not found.
  538. * The case of the header field name is ignored.
  539. * @param name the case-insensitive header field name
  540. */
  541. public int getIntHeader(String name) {
  542. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  543. checkRequestObjectInUse();
  544. }
  545. // 321485
  546. // PK80362 Start
  547. // int header = _request.getIntHeader(name);
  548. int header = -1;
  549. if ( (suppressHeadersInRequest == null) || !(isHeaderinSuppressedHeadersList(name))){
  550. header = _request.getIntHeader(name);
  551. }
  552. // PK80362 End
  553. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  554. logger.logp(Level.FINE, CLASS_NAME,"getIntHeader", "this->"+this+": "+" name --> " + name + " header --> " + String.valueOf(header));
  555. }
  556. return header;
  557. }
  558. public Enumeration getHeaders(String name) {
  559. // 321485
  560. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  561. logger.logp(Level.FINE, CLASS_NAME,"getHeaders", "this->"+this+": "+" name --> " + name);
  562. }
  563. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  564. checkRequestObjectInUse();
  565. }
  566. // PK80362 Start
  567. Enumeration header = null;
  568. if ( (suppressHeadersInRequest == null) || !(isHeaderinSuppressedHeadersList(name))){
  569. header = _request.getHeaders(name);
  570. }
  571. // return (_request.getHeaders(name));
  572. return header;
  573. // PK80362 End
  574. }
  575. public String getMethod() {
  576. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  577. checkRequestObjectInUse();
  578. }
  579. // 321485
  580. if (_srtRequestHelper._method == null)
  581. _srtRequestHelper._method = _request.getMethod();
  582. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  583. logger.logp(Level.FINE, CLASS_NAME,"getMethod", "this->"+this+": "+" method --> " + _srtRequestHelper._method);
  584. }
  585. return _srtRequestHelper._method;
  586. }
  587. /* (non-Javadoc)
  588. * @see javax.servlet.ServletRequest#getContentLength()
  589. */
  590. public int getContentLength() {
  591. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  592. checkRequestObjectInUse();
  593. }
  594. // 321485
  595. // PK57679 Start
  596. int contentLength;
  597. if (!_setInputDataStreamCalled) // 516233
  598. contentLength = this._request.getContentLength();
  599. else
  600. contentLength = (int)_setInputStreamContentLength;
  601. // PK57679 End
  602. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  603. logger.logp(Level.FINE, CLASS_NAME,"getContentLength", "this->"+this+": "+" length --> " + String.valueOf(contentLength));
  604. }
  605. return contentLength;
  606. }
  607. /* (non-Javadoc)
  608. * @see javax.servlet.ServletRequest#getContentType()
  609. */
  610. public String getContentType() {
  611. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  612. checkRequestObjectInUse();
  613. }
  614. // 321485
  615. // PK57679 Start
  616. String contentType;
  617. if (!_setInputDataStreamCalled) // 516233
  618. contentType = _request.getContentType();
  619. else
  620. contentType = _setInputStreamContentType;
  621. // PK57679 End
  622. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  623. logger.logp(Level.FINE, CLASS_NAME,"getContentType", "this->"+this+": "+" type --> " + contentType);
  624. }
  625. return contentType;
  626. }
  627. /* (non-Javadoc)
  628. * @see javax.servlet.ServletRequest#getProtocol()
  629. */
  630. public String getProtocol() {
  631. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  632. checkRequestObjectInUse();
  633. }
  634. // 321485
  635. String protocol = this._request.getProtocol();
  636. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  637. logger.logp(Level.FINE, CLASS_NAME,"getProtocol", "this->"+this+": "+" protocol --> " + protocol);
  638. }
  639. return protocol;
  640. }
  641. /* (non-Javadoc)
  642. * @see javax.servlet.ServletRequest#getScheme()
  643. */
  644. public String getScheme() {
  645. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  646. checkRequestObjectInUse();
  647. }
  648. // 321485
  649. String scheme = this._request.getScheme();
  650. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  651. logger.logp(Level.FINE, CLASS_NAME,"getScheme", "this->"+this+": "+" scheme --> " + scheme);
  652. }
  653. return scheme;
  654. }
  655. /* (non-Javadoc)
  656. * @see javax.servlet.ServletRequest#getServerPort()
  657. */
  658. public int getServerPort() {
  659. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  660. checkRequestObjectInUse();
  661. }
  662. // 321485
  663. int port = this._request.getServerPort();
  664. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  665. logger.logp(Level.FINE, CLASS_NAME,"getServerPort", "this->"+this+": "+" port --> " + String.valueOf(port));
  666. }
  667. return port;
  668. }
  669. /* (non-Javadoc)
  670. * @see javax.servlet.ServletRequest#getRemoteAddr()
  671. */
  672. public String getRemoteAddr() {
  673. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  674. checkRequestObjectInUse();
  675. }
  676. // 321485
  677. if (this._request != null) {
  678. String addr = this._request.getRemoteAddr();
  679. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  680. logger.logp(Level.FINE, CLASS_NAME,"getRemoteAddr", "this->"+this+": "+" address --> " + addr);
  681. }
  682. return addr;
  683. }
  684. return null;
  685. }
  686. /* (non-Javadoc)
  687. * @see javax.servlet.ServletRequest#getRemoteHost()
  688. */
  689. public String getRemoteHost() {
  690. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  691. checkRequestObjectInUse();
  692. }
  693. // 321485
  694. String host = null;
  695. if (this._request != null) {
  696. host = this._request.getRemoteHost();
  697. }
  698. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  699. logger.logp(Level.FINE, CLASS_NAME,"getRemoteHost", "this->"+this+": "+" host --> " + host);
  700. }
  701. return host;
  702. }
  703. /* (non-Javadoc)
  704. * @see javax.servlet.ServletRequest#setAttribute(java.lang.String, java.lang.Object)
  705. */
  706. public void setAttribute(String arg0, Object arg1) {
  707. // 321485
  708. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  709. logger.logp(Level.FINE, CLASS_NAME,"setAttribute", "this->"+this+": "+" name --> [" + arg0 + "], value --> [" + arg1 + "]");
  710. }
  711. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  712. checkRequestObjectInUse();
  713. }
  714. //PM71991 START
  715. if(WCCustomProperties.REMOVE_ATTRIBUTE_FOR_NULL_OBJECT && arg1== null){
  716. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  717. logger.logp(Level.FINE, CLASS_NAME,"setAttribute", "cannot set attribute with null value, remove the attribute -->"+arg0);
  718. }
  719. this.removeAttribute(arg0);
  720. }
  721. else{//PM71991 END
  722. Object oldValue = _srtRequestHelper._attributes.put(arg0, arg1);
  723. if (oldValue != null) {
  724. this.attributeReplaced(arg0, oldValue);
  725. } else {
  726. this.attributeAdded(arg0, arg1);
  727. }
  728. }
  729. }
  730. /* (non-Javadoc)
  731. * @see javax.servlet.ServletRequest#removeAttribute(java.lang.String)
  732. */
  733. public void removeAttribute(String arg0) {
  734. // 321485
  735. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  736. logger.logp(Level.FINE, CLASS_NAME,"removeAttribute", "this->"+this+": "+" name --> " + arg0);
  737. }
  738. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  739. checkRequestObjectInUse();
  740. }
  741. Object oldValue = _srtRequestHelper._attributes.remove(arg0);
  742. if (oldValue != null) {
  743. this.attributeRemoved(arg0, oldValue);
  744. }
  745. }
  746. /* (non-Javadoc)
  747. * @see javax.servlet.ServletRequest#getLocale()
  748. */
  749. public Locale getLocale() {
  750. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  751. checkRequestObjectInUse();
  752. }
  753. processLocales();
  754. // 321485
  755. Locale locale = (Locale) (_srtRequestHelper._locales.size() > 0 ? _srtRequestHelper._locales.get(0) : null);
  756. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  757. logger.logp(Level.FINE, CLASS_NAME,"getLocale", "this->"+this+": "+" locale --> " + (locale!=null?locale.toString():""));
  758. }
  759. return locale;
  760. }
  761. /* (non-Javadoc)
  762. * @see javax.servlet.ServletRequest#getLocales()
  763. */
  764. public Enumeration getLocales() {
  765. // 321485
  766. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  767. logger.logp(Level.FINE, CLASS_NAME,"getLocales", "this->"+this+": ");
  768. }
  769. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  770. checkRequestObjectInUse();
  771. }
  772. processLocales();
  773. return new Enumeration() {
  774. java.util.Iterator iter = _srtRequestHelper._locales.iterator();
  775. public boolean hasMoreElements() {
  776. return iter.hasNext();
  777. }
  778. public Object nextElement() {
  779. return iter.next();
  780. }
  781. };
  782. }
  783. /* (non-Javadoc)
  784. * @see javax.servlet.ServletRequest#isSecure()
  785. */
  786. public boolean isSecure() {
  787. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  788. checkRequestObjectInUse();
  789. }
  790. // 321485
  791. boolean secure = this._request.isSSL();
  792. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  793. logger.logp(Level.FINE, CLASS_NAME,"isSecure", "this->"+this+": "+" value --> " + String.valueOf(secure));
  794. }
  795. return secure;
  796. }
  797. public String getCipherSuite() {
  798. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  799. checkRequestObjectInUse();
  800. }
  801. // 321485
  802. String cipherSuite = _request.getCipherSuite();
  803. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  804. logger.logp(Level.FINE, CLASS_NAME,"getCipherSuite", "this->"+this+": "+" value --> " + cipherSuite);
  805. }
  806. return cipherSuite;
  807. }
  808. //PI75166
  809. public String getDirectConnectionCipherSuite() {
  810. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  811. checkRequestObjectInUse();
  812. }
  813. Class<? extends IRequest> requestClass = _request.getClass();
  814. String cipherSuite = null;
  815. if(checkAssignableFromIRequestImpl(requestClass)){
  816. Method method;
  817. try {
  818. method = requestClass.getMethod("getConnectionCipherSuite", null);
  819. cipherSuite = (String) method.invoke(_request, null);
  820. } catch (Exception e) {
  821. com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, "com.ibm.ws.webcontainer.srt.SRTServletRequest.getDirectConnectionCipherSuite", "587", this);
  822. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  823. logger.logp(Level.FINE, CLASS_NAME,"getDirectConnectionCipherSuite", "failed to retrieve direction connection cipher suite",e);
  824. }
  825. }
  826. }
  827. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  828. logger.logp(Level.FINE, CLASS_NAME,"getDirectConnectionCipherSuite", "this->"+this+": "+" value --> " + cipherSuite);
  829. }
  830. return cipherSuite;
  831. }
  832. /**
  833. * Return the peer (i.e. the client) certificates.
  834. * This must be an SSL connection with mutual authentication;
  835. * else, null is returned.
  836. * @return the peer certificates, or null if none.
  837. **/
  838. public X509Certificate[] getPeerCertificates()
  839. {
  840. // 321485
  841. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  842. logger.logp(Level.FINE, CLASS_NAME,"getPeerCertificates", "this->"+this+": ");
  843. }
  844. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  845. checkRequestObjectInUse();
  846. }
  847. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) logger.logp(Level.FINE, CLASS_NAME,"getPeerCertificates", "this->"+this+": "); //306998.15
  848. X509Certificate[] certs = _request.getPeerCertificates();
  849. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) logger.logp(Level.FINE, CLASS_NAME,"getPeerCertificates", "this->"+this+": "+"certificates", certs); //306998.15
  850. return certs;
  851. }
  852. /**
  853. * Return the peer (i.e. the client) certificates.
  854. * This must be an SSL connection with mutual authentication;
  855. * else, null is returned.
  856. * @return the peer certificates, or null if none.
  857. **/
  858. public X509Certificate[] getDirectConnectionPeerCertificates()
  859. {
  860. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  861. checkRequestObjectInUse();
  862. }
  863. Class<? extends IRequest> requestClass = _request.getClass();
  864. X509Certificate[] certs = null;
  865. //PI75166
  866. if(checkAssignableFromIRequestImpl(requestClass)){
  867. Method method;
  868. try {
  869. method = requestClass.getMethod("getConnectionPeerCertificates", null);
  870. certs = (X509Certificate[]) method.invoke(_request, null);
  871. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  872. logger.logp(Level.FINE, CLASS_NAME,"getDirectConnectionPeerCertificates", "this->"+this+": "+" certs value --> " + certs);
  873. }
  874. } catch (Exception e) {
  875. com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, "com.ibm.ws.webcontainer.srt.SRTServletRequest.getDirectConnectionPeerCertificates", "635", this);
  876. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  877. logger.logp(Level.FINE, CLASS_NAME,"getDirectConnectionPeerCertificates", "failed to retrieve direction connection cipher suite",e);
  878. }
  879. }
  880. }
  881. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  882. logger.logp(Level.FINE, CLASS_NAME,"getDirectConnectionPeerCertificates", "this->"+this+": "+" value --> " + certs);
  883. }
  884. return certs;
  885. }
  886. //PI75166
  887. /**
  888. * @param requestClass
  889. * @return
  890. */
  891. private boolean checkAssignableFromIRequestImpl(Class<? extends IRequest> requestClass){
  892. Class<? extends IRequest> ir = com.ibm.ws.webcontainer.osgi.request.IRequestImpl.class;
  893. boolean check = ir.isAssignableFrom(requestClass);
  894. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  895. logger.logp(Level.FINE, CLASS_NAME,"checkAssignableFromIRequestImpl", "this->"+this+": "
  896. +" request class --> " + requestClass +" ,ir class --> " + ir +" isAssignableFrom -->" + check);
  897. }
  898. return check;
  899. }
  900. //F001872
  901. private Boolean isDirectConnection()
  902. {
  903. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  904. checkRequestObjectInUse();
  905. }
  906. Boolean direct = Boolean.valueOf("false");
  907. Class<? extends IRequest> requestClass = _request.getClass();
  908. //PI75166
  909. if(checkAssignableFromIRequestImpl(requestClass)){
  910. Method method;
  911. try{
  912. method = requestClass.getMethod("checkForDirectConnection", null);
  913. direct = (Boolean) method.invoke(_request, null);
  914. }
  915. catch (Exception e) {
  916. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  917. logger.logp(Level.FINE, CLASS_NAME,"isDirectConnection", "failed to retrieve direct connection check",e);
  918. }
  919. }
  920. }
  921. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  922. logger.logp(Level.FINE, CLASS_NAME,"isDirectConnection", "return -> "+ direct.booleanValue());
  923. }
  924. return direct;
  925. }
  926. //F001872 - end
  927. /**
  928. * Sets the _request.
  929. * @param _request The _request to set
  930. */
  931. public void setRequest(IRequest _request) {
  932. // 321485
  933. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  934. logger.logp(Level.FINE, CLASS_NAME,"setRequest", "this->"+this+": ");
  935. }
  936. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  937. checkRequestObjectInUse();
  938. }
  939. this._request = _request;
  940. }
  941. public void attributeAdded(String key, Object newVal)
  942. {
  943. // 321485
  944. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  945. logger.logp(Level.FINE, CLASS_NAME,"attributeAdded", "this->"+this+": "+" key --> " + key + " value --> " + newVal);
  946. }
  947. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  948. checkRequestObjectInUse();
  949. }
  950. WebApp webapp = getDispatchContext().getWebApp();
  951. if (webapp != null)
  952. webapp.notifyServletRequestAttrAdded(this, key, newVal);
  953. }
  954. public void attributeRemoved(String key, Object oldVal) {
  955. // 321485
  956. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  957. logger.logp(Level.FINE, CLASS_NAME,"attributeRemoved", "this->"+this+": "+" key --> " + key + " value --> " + oldVal);
  958. }
  959. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  960. checkRequestObjectInUse();
  961. }
  962. WebApp webapp = getDispatchContext().getWebApp();
  963. if (webapp != null)
  964. webapp.notifyServletRequestAttrRemoved(this, key, oldVal);
  965. }
  966. public void attributeReplaced(String key, Object oldVal) {
  967. // 321485
  968. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  969. logger.logp(Level.FINE, CLASS_NAME,"attributeReplaced", "this->"+this+": "+" key --> " + key + " value --> " + oldVal);
  970. }
  971. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  972. checkRequestObjectInUse();
  973. }
  974. WebApp webapp = getDispatchContext().getWebApp();
  975. if (webapp != null)
  976. webapp.notifyServletRequestAttrReplaced(this, key, oldVal);
  977. }
  978. protected void setLocales(Iterator iter) {
  979. // 321485
  980. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  981. logger.logp(Level.FINE, CLASS_NAME,"setLocales", "this->"+this+": ");
  982. }
  983. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  984. checkRequestObjectInUse();
  985. }
  986. while (iter.hasNext()) {
  987. _srtRequestHelper._locales.add(iter.next());
  988. }
  989. }
  990. /**
  991. * Returns an input stream for reading binary request data.
  992. *
  993. * Note for MultiRead:
  994. * If this is the first call - register an observer to get a notification (alertClose()) when input stream is closed.
  995. * If this is first call afterClose, restart the input stream. This will cause a notification (alertOpen()) that the input stream has been opened.
  996. * Any other call - no special processing.
  997. */
  998. public ServletInputStream getInputStream() throws IOException {
  999. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1000. logger.logp(Level.FINE, CLASS_NAME,"getInputStream", "this->"+this+": gotReader = " + _srtRequestHelper._gotReader);
  1001. }
  1002. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1003. checkRequestObjectInUse();
  1004. }
  1005. // MultiRead Start
  1006. // if stream is currently closed, allow re-read.
  1007. // otherwise this must be the first read so register as an observer to be notified when close occurs.
  1008. if (this.multiReadPropertyEnabled) {
  1009. if (_srtRequestHelper._InputStreamClosed) {
  1010. ((SRTInputStream) this._in).restart();
  1011. }
  1012. }
  1013. if (_srtRequestHelper._gotReader)
  1014. throw new IllegalStateException( liberty_nls.getString("Reader.already.obtained", "Reader already obtained"));
  1015. // MultiRead End
  1016. _srtRequestHelper._gotInputStream = true;
  1017. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1018. logger.logp(Level.FINE, CLASS_NAME,"getInputStream", "stream->"+_in+": gotReader = " + _srtRequestHelper._gotReader);
  1019. }
  1020. return _in;
  1021. }
  1022. /*
  1023. * Added for MultiRead for use by ParseParameters
  1024. * For multi-read returns a ServletInputStream input stream irrespective of whether a
  1025. * reader has been obtained. The behavior if a reader has been obtained but not closed
  1026. * is the same as normal behavior (no multi-read) if parseParameters gets the input stream
  1027. * when a servletInputStream has been previously obtained but not closed. A failure will
  1028. * result - insufficient post data.
  1029. */
  1030. // protected ServletInputStream getInputStreamInternal() throws IOException {
  1031. // if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1032. // checkRequestObjectInUse();
  1033. // }
  1034. // if (this.multiReadPropertyEnabled) {
  1035. // if (_srtRequestHelper._InputStreamClosed) {
  1036. // ((SRTInputStream) this._in).restart();
  1037. // }
  1038. // _srtRequestHelper._gotInputStream = true;
  1039. // return _in;
  1040. // } else {
  1041. // return getInputStream();
  1042. // }
  1043. // }
  1044. public IRequest getIRequest(){
  1045. //321485
  1046. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1047. logger.logp(Level.FINE, CLASS_NAME,"getIRequest", "this->"+this+": ");
  1048. }
  1049. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1050. checkRequestObjectInUse();
  1051. }
  1052. return _request;
  1053. }
  1054. /*
  1055. * Note for MultiRead:
  1056. * If this is the first call - register an observer to get a notification (alertClose()) when input stream is closed.
  1057. * If the is first call after alerClose, restart the input stream. This will cause a notification (alertOpen()) that the input stream has been opened.
  1058. * Any other call - no special processing.
  1059. */
  1060. public synchronized BufferedReader getReader()
  1061. throws UnsupportedEncodingException, IOException {
  1062. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1063. logger.logp(Level.FINE, CLASS_NAME,"getReader", "this->"+this+": gotInputStream = " + _srtRequestHelper._gotInputStream);
  1064. }
  1065. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1066. checkRequestObjectInUse();
  1067. }
  1068. // MultiRead Start
  1069. if (this.multiReadPropertyEnabled) {
  1070. if (_srtRequestHelper._InputStreamClosed) {
  1071. ((SRTInputStream) this._in).restart();
  1072. }
  1073. }
  1074. // MultiRead End
  1075. if (_srtRequestHelper._gotInputStream){
  1076. throw new IllegalStateException(liberty_nls.getString( "InputStream.already.obtained", "Input Stream already obtained"));
  1077. }
  1078. if (_srtRequestHelper._reader == null) {
  1079. _srtRequestHelper._reader =
  1080. new BufferedReader( new InputStreamReader(_in, getReaderEncoding()));
  1081. }
  1082. _srtRequestHelper._gotReader = true; // MultiRead
  1083. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1084. logger.logp(Level.FINE, CLASS_NAME,"getReader", "this->"+this+": reader = " + _srtRequestHelper._reader);
  1085. }
  1086. return _srtRequestHelper._reader;
  1087. }
  1088. /*
  1089. * Releases the InputStream once the obtainer has no more need for it.
  1090. */
  1091. protected void releaseInputStream() {
  1092. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1093. checkRequestObjectInUse();
  1094. }
  1095. if (_srtRequestHelper._gotInputStream) {
  1096. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1097. logger.logp(Level.FINE, CLASS_NAME,"releaseInputStream()" ,"");
  1098. }
  1099. _srtRequestHelper._gotInputStream = false;
  1100. }
  1101. }
  1102. /*
  1103. * Releases the Reader once the obtainer has no more need for it.
  1104. */
  1105. protected void releaseReader() {
  1106. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1107. checkRequestObjectInUse();
  1108. }
  1109. if (_srtRequestHelper._gotReader) {
  1110. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1111. logger.logp(Level.FINE, CLASS_NAME,"releaseReader()" ,"");
  1112. }
  1113. _srtRequestHelper._gotReader = false;
  1114. _srtRequestHelper._reader = null;
  1115. }
  1116. }
  1117. // MultiRead Start
  1118. /* Indicates that the input stream, obtained using either getInputStream
  1119. * or getReader has been closed.
  1120. */
  1121. public void alertOpen() {
  1122. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1123. logger.logp(Level.FINE, CLASS_NAME,"alertOpen()", "");
  1124. }
  1125. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1126. checkRequestObjectInUse();
  1127. }
  1128. _srtRequestHelper._InputStreamClosed=false;
  1129. }
  1130. /* Indicates that the input stream, obtained using either getInputStream
  1131. * or getReader has been closed.
  1132. */
  1133. public void alertClose() {
  1134. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1135. logger.logp(Level.FINE, CLASS_NAME,"alertClose()", "");
  1136. }
  1137. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1138. checkRequestObjectInUse();
  1139. }
  1140. _srtRequestHelper._InputStreamClosed=true;
  1141. }
  1142. /**
  1143. * @return SRTConnectionContext
  1144. */
  1145. protected SRTConnectionContext getConnectionContext() {
  1146. //321485
  1147. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1148. logger.logp(Level.FINE, CLASS_NAME,"getConnectionContext", "");
  1149. }
  1150. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1151. checkRequestObjectInUse();
  1152. }
  1153. return _connContext;
  1154. }
  1155. /* (non-Javadoc)
  1156. * @see com.ibm.ws.webcontainer.core.Request#getWebAppContext()
  1157. */
  1158. public IWebAppDispatcherContext getWebAppDispatcherContext() {
  1159. //321485
  1160. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1161. logger.logp(Level.FINE, CLASS_NAME,"getWebAppDispatcherContext", " "+this);
  1162. }
  1163. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1164. checkRequestObjectInUse();
  1165. }
  1166. IWebAppDispatcherContext dc=null;
  1167. dc = SRTServletRequestThreadData.getInstance().getDispatchContext();
  1168. if (dc==null){
  1169. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1170. logger.logp(Level.FINE, CLASS_NAME,"getWebAppDispatcherContext", " return _dispatchContext "+ _dispatchContext );
  1171. }
  1172. dc = _dispatchContext;
  1173. }
  1174. return dc;
  1175. }
  1176. /* (non-Javadoc)
  1177. * @see com.ibm.ws.webcontainer.core.Request#setWebAppContext(com.ibm.ws.webcontainer.webapp.WebAppContext)
  1178. */
  1179. public void setWebAppDispatcherContext(IWebAppDispatcherContext ctx) {
  1180. // 321485
  1181. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15
  1182. logger.logp(Level.FINE, CLASS_NAME,"setWebAppDispatcherContext", " old context [" + this.getDispatchContext() + "] new context [" + ctx +"]");
  1183. }
  1184. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1185. checkRequestObjectInUse();
  1186. }
  1187. SRTServletRequestThreadData.getInstance().setDispatchContext(ctx);
  1188. this._dispatchContext = (WebAppDispatcherContext) ctx;
  1189. resetPathElements();
  1190. }
  1191. public void resetPathElements (){
  1192. //321485
  1193. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1194. logger.logp(Level.FINE, CLASS_NAME,"resetPathElements", "");
  1195. }
  1196. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1197. checkRequestObjectInUse();
  1198. }
  1199. SRTServletRequestThreadData.getInstance().setRequestURI(null);
  1200. SRTServletRequestThreadData.getInstance().setPathInfo(null);
  1201. }
  1202. /* (non-Javadoc)
  1203. * @see javax.servlet.ServletRequest#getLocalAddr()
  1204. */
  1205. public String getLocalAddr() {
  1206. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1207. checkRequestObjectInUse();
  1208. }
  1209. // 321485
  1210. String addr = null;
  1211. if (this._request != null) {
  1212. addr = this._request.getLocalAddr();
  1213. }
  1214. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1215. logger.logp(Level.FINE, CLASS_NAME,"getLocalAddr", " address --> " + addr);
  1216. }
  1217. return addr;
  1218. }
  1219. /* (non-Javadoc)
  1220. * @see javax.servlet.ServletRequest#getLocalName()
  1221. */
  1222. public String getLocalName() {
  1223. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1224. checkRequestObjectInUse();
  1225. }
  1226. // 321485
  1227. String name = this._request.getLocalName();
  1228. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1229. logger.logp(Level.FINE, CLASS_NAME,"getLocalName", " name --> " + name);
  1230. }
  1231. return name;
  1232. }
  1233. /* (non-Javadoc)
  1234. * @see javax.servlet.ServletRequest#getLocalPort()
  1235. */
  1236. public int getLocalPort() {
  1237. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1238. checkRequestObjectInUse();
  1239. }
  1240. // 321485
  1241. int port = 0;
  1242. if (this._request != null) {
  1243. port = this._request.getLocalPort();
  1244. }
  1245. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1246. logger.logp(Level.FINE, CLASS_NAME,"getLocalPort", " port --> " + String.valueOf(port));
  1247. }
  1248. return port;
  1249. }
  1250. /* (non-Javadoc)
  1251. * @see javax.servlet.ServletRequest#getRemotePort()
  1252. */
  1253. public int getRemotePort() {
  1254. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1255. checkRequestObjectInUse();
  1256. }
  1257. // 321485
  1258. int port = 0;
  1259. if (this._request != null) {
  1260. port = this._request.getRemotePort();
  1261. }
  1262. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1263. logger.logp(Level.FINE, CLASS_NAME,"getRemotePort", " port --> " + String.valueOf(port));
  1264. }
  1265. return port;
  1266. }
  1267. public IExtendedResponse getResponse() {
  1268. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1269. checkRequestObjectInUse();
  1270. }
  1271. return this._connContext.getResponse();
  1272. }
  1273. public void setResponse(IExtendedResponse extResp) {
  1274. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1275. checkRequestObjectInUse();
  1276. }
  1277. this._connContext.setResponse(extResp);
  1278. }
  1279. public void start() {
  1280. }
  1281. protected void copyFrom(SRTServletRequest original) throws CloneNotSupportedException {
  1282. if (original._requestContext != null) {
  1283. _requestContext = (SRTRequestContext) original._requestContext.clone(this);
  1284. }
  1285. if (original.getDispatchContext() != null) {
  1286. setWebAppDispatcherContext((WebAppDispatcherContext) original.getDispatchContext().clone(this, _requestContext));
  1287. }
  1288. if(original._connContext!=null){
  1289. _connContext = (SRTConnectionContext) original._connContext.clone(this, _dispatchContext);
  1290. }
  1291. if (original._srtRequestHelper != null) {
  1292. _srtRequestHelper = (SRTServletRequestHelper) original._srtRequestHelper.clone();
  1293. }
  1294. if (original._paramStack != null) {
  1295. _paramStack = (UnsynchronizedStack) original._paramStack.clone();
  1296. }
  1297. }
  1298. public Object clone() throws CloneNotSupportedException {
  1299. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1300. logger.logp(Level.FINE, CLASS_NAME,"clone", " entry");
  1301. }
  1302. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1303. checkRequestObjectInUse();
  1304. }
  1305. SRTServletRequest clonedSRTServletRequest = (SRTServletRequest) super.clone();
  1306. clonedSRTServletRequest.copyFrom(this);
  1307. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1308. logger.logp(Level.FINE, CLASS_NAME,"clone", " exit original -->" + this + " cloned -->" + clonedSRTServletRequest);
  1309. }
  1310. return clonedSRTServletRequest;
  1311. }
  1312. // LIDB1234.5 - modify method below to return request object static variables
  1313. /**
  1314. * Returns the authentication scheme of the request, or null if none.
  1315. * Same as the CGI variable AUTH_TYPE.
  1316. */
  1317. public String getAuthType()
  1318. {
  1319. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1320. checkRequestObjectInUse();
  1321. }
  1322. String authType = null;
  1323. //if (com.ibm.ws.security.core.SecurityContext.isSecurityEnabled())
  1324. if(((WebAppDispatcherContext)this.getDispatchContext()).isSecurityEnabledForApplication())
  1325. {
  1326. authType = (String) getPrivateAttribute("AUTH_TYPE");
  1327. }
  1328. else
  1329. {
  1330. authType = _request.getAuthType();
  1331. }
  1332. //321485
  1333. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1334. logger.logp(Level.FINE, CLASS_NAME,"getAuthType", " authType --> " + authType);
  1335. }
  1336. // return one of the static vars defined in HttpServletRequest
  1337. if (authType != null)
  1338. {
  1339. if (authType.equals("BASIC"))
  1340. return HttpServletRequest.BASIC_AUTH;
  1341. else if (authType.equals("CLIENT_CERT"))
  1342. return HttpServletRequest.CLIENT_CERT_AUTH;
  1343. else if (authType.equals("DIGEST"))
  1344. return HttpServletRequest.DIGEST_AUTH;
  1345. else if (authType.equals("FORM"))
  1346. return HttpServletRequest.FORM_AUTH;
  1347. }
  1348. return authType;
  1349. }
  1350. public String getCharacterEncoding()
  1351. {
  1352. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1353. checkRequestObjectInUse();
  1354. }
  1355. if (_srtRequestHelper._characterEncoding != null)
  1356. return _srtRequestHelper._characterEncoding;
  1357. // first see if it's been specified in the content type header
  1358. // Begin 287829, Fix setContentType when qoutes are a part of the charset
  1359. String type = getContentType();
  1360. int index = -1;
  1361. if (type != null)
  1362. index = type.indexOf("charset=");
  1363. String _encoding = getEncodingFromContentType(type, index);
  1364. if (_encoding != null)
  1365. {
  1366. try
  1367. {
  1368. setCharacterEncoding(_encoding);
  1369. }
  1370. catch (UnsupportedEncodingException e)
  1371. {
  1372. logger.logp(Level.INFO, CLASS_NAME,"getCharacterEncoding", "Unable to set request character encoding based upon request header ", e);
  1373. }
  1374. }
  1375. return _encoding;
  1376. }
  1377. public static String getEncodingFromContentType(String type,int index) {
  1378. String _encoding = null;
  1379. if (index > -1)
  1380. {
  1381. int startIndex = index + 8;
  1382. int endIndex;
  1383. int semicolonIndex = type.indexOf(';', startIndex + 1);
  1384. if (semicolonIndex==-1){
  1385. endIndex = type.length() - 1;
  1386. }
  1387. else {
  1388. endIndex = semicolonIndex - 1;
  1389. }
  1390. if (startIndex<=endIndex){
  1391. boolean startsWithQoute = type.charAt(startIndex) == '"' || type.charAt(startIndex) == '\'';
  1392. boolean endsWithQoute = type.charAt(endIndex) == '"' || type.charAt(endIndex) == '\'';
  1393. if (startsWithQoute && endsWithQoute)
  1394. _encoding = type.substring(startIndex + 1, endIndex);
  1395. else {
  1396. if (semicolonIndex == -1)
  1397. _encoding = type.substring(startIndex);
  1398. else
  1399. _encoding = type.substring(startIndex, semicolonIndex);
  1400. }
  1401. }
  1402. }
  1403. // 321485
  1404. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1405. logger.logp(Level.FINE, CLASS_NAME,"getEncodingFromContentType", "type->"+type+", encoding --> " + _encoding);
  1406. }
  1407. return _encoding;
  1408. }
  1409. public String getReaderEncoding()
  1410. {
  1411. return getReaderEncoding(false);
  1412. }
  1413. public String getReaderEncoding(boolean ignoreInvalid) {
  1414. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1415. checkRequestObjectInUse();
  1416. }
  1417. // see if it's already set.
  1418. // Make sure that getReaderEncodin(false) followed by
  1419. // getReaderEncoing(true) both get the same result if called in the
  1420. // opposite order.
  1421. if (_srtRequestHelper._readerEncoding != null && !ignoreInvalid)
  1422. {
  1423. return _srtRequestHelper._readerEncoding;
  1424. } else if (_srtRequestHelper._readerEncodingInvalidIgnored != null && ignoreInvalid) {
  1425. return _srtRequestHelper._readerEncodingInvalidIgnored;
  1426. }
  1427. // 115780 - set encoding to the static override if the user has set it
  1428. String encoding = CLIENT_ENCODING_OVERRIDE;
  1429. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  1430. logger.logp(Level.FINE, CLASS_NAME,"getReaderEncoding", "client encoding override --> " + encoding);
  1431. Boolean invalidIgnored=false;
  1432. // try getting from the char set var (basically looking for it in content type header or from setCharacterEncoding())
  1433. if (encoding == null)
  1434. {
  1435. encoding = getCharacterEncoding();
  1436. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  1437. logger.logp(Level.FINE, CLASS_NAME,"getReaderEncoding", "content-type header --> " + encoding);
  1438. if (encoding != null && ignoreInvalid && !EncodingUtils.isCharsetSupported(encoding)) {
  1439. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  1440. logger.logp(Level.FINE, CLASS_NAME,"getReaderEncoding", "content-type header encoding is invalid, so ignore it.");
  1441. encoding = null;
  1442. invalidIgnored=true;
  1443. }
  1444. }
  1445. WebAppConfiguration webAppCfg = ((WebAppDispatcherContext) this.getDispatchContext()).getWebApp().getConfiguration();
  1446. // not specifyed by character encoding...if autoRequestEncoding is on, try to determine
  1447. // from the accepted languages
  1448. if (encoding == null && webAppCfg.isAutoRequestEncoding())
  1449. {
  1450. String acceptLanguage = getHeader("Accept-Language");
  1451. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  1452. logger.logp(Level.FINE, CLASS_NAME,"getReaderEncoding", "accept-language --> " + acceptLanguage);
  1453. if (acceptLanguage != null && (!acceptLanguage.equals("*")))
  1454. {
  1455. Locale _locale = getLocale();
  1456. /**
  1457. * Check the DD locale-endoding mappings to see if there is a specified mapping
  1458. * @since Servlet 2.4
  1459. */
  1460. encoding = webAppCfg.getLocaleEncoding(_locale);
  1461. if (encoding == null) {
  1462. encoding = EncodingUtils.getEncodingFromLocale(_locale);
  1463. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  1464. logger.logp(Level.FINE, CLASS_NAME,"getReaderEncoding", "encoding from locale --> " + encoding);
  1465. }
  1466. }
  1467. }
  1468. if (encoding == null)
  1469. {
  1470. // 115780 - set encoding to the static default if the user has set it
  1471. encoding = DEFAULT_CLIENT_ENCODING;
  1472. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  1473. logger.logp(Level.FINE, CLASS_NAME,"getReaderEncoding", "default client encoding -->" + encoding);
  1474. }
  1475. if (encoding == null)
  1476. {
  1477. // no choice but to default to the standard
  1478. encoding = "ISO-8859-1";
  1479. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  1480. logger.logp(Level.FINE, CLASS_NAME,"getReaderEncoding", "default encoding --> " + encoding);
  1481. }
  1482. String returnEncoding = EncodingUtils.getJvmConverter(encoding);
  1483. // If an invalid encoding was not used, save result as resgular outcome
  1484. if (!invalidIgnored )
  1485. _srtRequestHelper._readerEncoding = returnEncoding;
  1486. // If an invalid encoding was to be ignore, save result ad the ingore inavlid result
  1487. if (ignoreInvalid)
  1488. _srtRequestHelper._readerEncodingInvalidIgnored = returnEncoding;
  1489. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  1490. logger.logp(Level.FINE, CLASS_NAME,"getReaderEncoding", " encoding converted --> " + returnEncoding);
  1491. return (returnEncoding);
  1492. }
  1493. public Cookie[] getCookies()
  1494. {
  1495. //321485
  1496. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1497. logger.logp(Level.FINE, CLASS_NAME,"getCookies", "");
  1498. }
  1499. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1500. checkRequestObjectInUse();
  1501. }
  1502. if (!_srtRequestHelper._cookiesParsed)
  1503. {
  1504. _srtRequestHelper._cookies = _request.getCookies();
  1505. _srtRequestHelper._cookiesParsed = true;
  1506. }
  1507. return _srtRequestHelper._cookies;
  1508. }
  1509. // PQ94384
  1510. public void addParameter(String name, String[] values) {
  1511. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1512. checkRequestObjectInUse();
  1513. }
  1514. Hashtable aParam = new Hashtable(3);
  1515. aParam.put(name, values);
  1516. mergeQueryParams(aParam);
  1517. }
  1518. // PQ94384
  1519. public void setMethod(String method)
  1520. {
  1521. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1522. checkRequestObjectInUse();
  1523. }
  1524. _srtRequestHelper._method = method;
  1525. }
  1526. // PK57679 Start - add methods setInputStreamData() and getInputStreamData() to be used by security code
  1527. public void setInputStreamData(HashMap inStreamInfo) throws IOException
  1528. {
  1529. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1530. checkRequestObjectInUse();
  1531. }
  1532. if (_srtRequestHelper._gotReader)
  1533. {
  1534. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  1535. logger.logp(Level.FINE, CLASS_NAME,"setInputStreamData","attempt to setInputStreamData after it has been read");
  1536. throw new IllegalStateException(
  1537. liberty_nls.getString(
  1538. "Reader.already.obtained",
  1539. "Reader already obtained"));
  1540. } else {
  1541. _setInputDataStreamCalled = true; // 516233
  1542. if (inStreamInfo != null)
  1543. {
  1544. // 516233 - the input map should have a contentLength, if not we were given the wring map
  1545. Integer contentLength = (Integer) inStreamInfo.get(INPUT_STREAM_CONTENT_DATA_LENGTH);
  1546. if (contentLength==null) {
  1547. // security passed in a map that we did not create - should not happen
  1548. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  1549. logger.logp(Level.FINE, CLASS_NAME,"setInputStreamData", "No content length in passed map. Throw IOException");
  1550. throw new IllegalStateException();
  1551. } else {
  1552. _setInputStreamContentLength = contentLength.intValue();
  1553. _setInputStreamContentType = (String) inStreamInfo.get(INPUT_STREAM_CONTENT_TYPE);
  1554. byte[] inStreamContentData = (byte[]) inStreamInfo.get(INPUT_STREAM_CONTENT_DATA);
  1555. // 516233 allow for no post data
  1556. if (inStreamContentData != null)
  1557. {
  1558. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  1559. logger.logp(Level.FINE, CLASS_NAME, "setInputStreamData", "SetInputStreamData Content Type = " + _setInputStreamContentType + ", " +
  1560. "contentLength = " + _setInputStreamContentLength+ ", data length = " + inStreamContentData.length + " : this = " + this );
  1561. ByteArrayInputStream inDataInputStream = new ByteArrayInputStream(inStreamContentData);
  1562. try
  1563. {
  1564. _in.init(inDataInputStream);
  1565. if (inStreamContentData.length > 0)
  1566. {
  1567. _in.setContentLength(inStreamContentData.length);
  1568. }
  1569. SRTServletRequestThreadData.getInstance().setParameters(null); //reset output of parseParameter method.
  1570. }
  1571. catch (IOException exc)
  1572. {
  1573. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  1574. logger.logp(Level.FINE, CLASS_NAME, "setInputStreamData", "Exception caught : " + exc );
  1575. throw exc;
  1576. }
  1577. }
  1578. }
  1579. } else {
  1580. // securty passed didn't provide a map - should not happen
  1581. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  1582. logger.logp(Level.FINE, CLASS_NAME, "setInputStreamData","No map passed as input");
  1583. throw new IllegalArgumentException();
  1584. }
  1585. }
  1586. }
  1587. public HashMap getInputStreamData() throws IOException
  1588. {
  1589. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){
  1590. logger.entering(CLASS_NAME, "getInputStreamData");
  1591. logger.logp(Level.FINE, CLASS_NAME,"getInputStreamData","[" + this + "]");
  1592. }
  1593. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1594. checkRequestObjectInUse();
  1595. }
  1596. ServletInputStream in = this.getInputStream();
  1597. HashMap inStreamInfo = new HashMap();
  1598. // 516233 allow for getContentType() returning null
  1599. if (this.getContentType() != null)
  1600. {
  1601. inStreamInfo.put(INPUT_STREAM_CONTENT_TYPE, new String(this.getContentType()));
  1602. } else {
  1603. inStreamInfo.put(INPUT_STREAM_CONTENT_TYPE, null);
  1604. }
  1605. int offset = 0, inputLen = 0, len = getContentLength();
  1606. // 516233 add content length
  1607. inStreamInfo.put(INPUT_STREAM_CONTENT_DATA_LENGTH, new Integer(len));
  1608. // 516133 allow for no post data
  1609. if (len > 0)
  1610. {
  1611. byte[] postedBytes = new byte[len];
  1612. do
  1613. {
  1614. inputLen = in.read(postedBytes, offset, len - offset);
  1615. if (inputLen <= 0)
  1616. {
  1617. String msg = nls.getString("post.body.contains.less.bytes.than.specified", "post body contains less bytes than specified by content-length");
  1618. throw new IOException(msg);
  1619. }
  1620. offset += inputLen;
  1621. }
  1622. while ((len - offset) > 0);
  1623. inStreamInfo.put(INPUT_STREAM_CONTENT_DATA, postedBytes);
  1624. } else {
  1625. inStreamInfo.put(INPUT_STREAM_CONTENT_DATA, null);
  1626. }
  1627. if (in != null) {
  1628. releaseInputStream();
  1629. }
  1630. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){
  1631. logger.logp(Level.FINE, CLASS_NAME,"getInputStreamData","ContentType = " + this.getContentType() + ", data length = " + len);
  1632. logger.exiting(CLASS_NAME, "getInputStreamData");
  1633. }
  1634. return inStreamInfo;
  1635. }
  1636. // PK57679 End
  1637. public void setRawParameters(Hashtable params)
  1638. {
  1639. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1640. checkRequestObjectInUse();
  1641. }
  1642. //321485
  1643. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1644. logger.logp(Level.FINE, CLASS_NAME,"setRawParameters", "");
  1645. }
  1646. SRTServletRequestThreadData.getInstance().setParameters(params);
  1647. }
  1648. public Hashtable getRawParameters()
  1649. {
  1650. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1651. checkRequestObjectInUse();
  1652. }
  1653. //321485
  1654. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1655. logger.logp(Level.FINE, CLASS_NAME,"getRawParameters", "");
  1656. }
  1657. parseParameters();
  1658. return (Hashtable) SRTServletRequestThreadData.getInstance().getParameters();
  1659. }
  1660. /**
  1661. * Returns the value of the specified parameter for the request. For
  1662. * example, in an HTTP servlet this would return the value of the
  1663. * specified query string parameter. This must be used when the
  1664. * application is sure that there is only one value for the parameter.
  1665. * For multiple valued parameters, use getParameterValues.
  1666. * @param name the parameter name
  1667. * @return the value for the parameter. For multiple values, a comma
  1668. * separated string of values is returned. Preferred way is to call
  1669. * getParameterValues for multiple valued parameters.
  1670. * @see getParameterValues
  1671. */
  1672. public String getParameter(String name)
  1673. {
  1674. // 321485
  1675. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1676. logger.logp(Level.FINE, CLASS_NAME,"getParameter", " name --> " + name);
  1677. }
  1678. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1679. checkRequestObjectInUse();
  1680. }
  1681. parseParameters();
  1682. String[] values = (String[]) SRTServletRequestThreadData.getInstance().getParameters().get(name);
  1683. String value=null;
  1684. if (values != null && values.length > 0)
  1685. {
  1686. value = values[0];
  1687. }
  1688. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1689. logger.logp(Level.FINE, CLASS_NAME,"getParameter", " value --> " + name);
  1690. }
  1691. return value;
  1692. }
  1693. /**
  1694. * Returns an enumeration of strings representing the parameter names
  1695. * for this request.
  1696. */
  1697. public Enumeration getParameterNames()
  1698. {
  1699. //321485
  1700. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1701. logger.logp(Level.FINE, CLASS_NAME,"getParameterNames", "");
  1702. }
  1703. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1704. checkRequestObjectInUse();
  1705. }
  1706. parseParameters();
  1707. return ((Hashtable) SRTServletRequestThreadData.getInstance().getParameters()).keys();
  1708. }
  1709. /**
  1710. * Returns the value of the specified parameter for the request. For
  1711. * example, in an HTTP servlet this would return the value of the
  1712. * specified query string parameter.
  1713. * @param name the parameter name
  1714. * @return an array of values for the passed parameter name. If there are
  1715. * no values then return null.
  1716. */
  1717. public String[] getParameterValues(String name)
  1718. {
  1719. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1720. checkRequestObjectInUse();
  1721. }
  1722. parseParameters();
  1723. // 321485
  1724. String[] values = (String[]) SRTServletRequestThreadData.getInstance().getParameters().get(name);
  1725. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1726. logger.logp(Level.FINE, CLASS_NAME,"getParameterValues", " name --> " + name);
  1727. }
  1728. //PI20210
  1729. if (WCCustomProperties.PRESERVE_REQUEST_PARAMETER_VALUES){
  1730. if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1731. logger.logp(Level.FINE, CLASS_NAME,"getParameterValues", " returning a clone of parameter values");
  1732. }
  1733. return (values == null ? null : values.clone());
  1734. }
  1735. else{ //PI20210
  1736. return values;
  1737. }
  1738. }
  1739. /**
  1740. * Returns null since this request has no concept of servlet mappings.
  1741. * This method will be overidden by the webapp layer.
  1742. */
  1743. public String getPathInfo()
  1744. {
  1745. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1746. checkRequestObjectInUse();
  1747. }
  1748. SRTServletRequestThreadData reqData=SRTServletRequestThreadData.getInstance();
  1749. // Begin PK06988, strip session id of when url rewriting is enabled
  1750. if (reqData.getPathInfo()==null){
  1751. String aPathInfo = ((WebAppDispatcherContext) this.getDispatchContext()).getPathInfo();
  1752. if (aPathInfo == null)
  1753. return null;
  1754. else { // Do not strip based on ? again, it was already done and we don't want to strip '%3f's that have since been decoded to ?'s
  1755. reqData.setPathInfo(WebGroup.stripURL(aPathInfo,false)); //293696 ServletRequest.getPathInfo() fails WASCC.web.webcontainer
  1756. }
  1757. }
  1758. // 321485
  1759. String path = reqData.getPathInfo();
  1760. // PK28078
  1761. if(path.equals("")) {
  1762. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  1763. logger.logp(Level.FINE, CLASS_NAME,"getPathInfo", " path is \"\", returning null");
  1764. return null;
  1765. }
  1766. else {
  1767. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  1768. logger.logp(Level.FINE, CLASS_NAME,"getPathInfo", " path --> [" + path + "]");
  1769. return path;
  1770. }
  1771. // return path;
  1772. // End PK06988, strip session id of when url rewriting is enabled
  1773. }
  1774. public String getServletPath() {
  1775. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE) {
  1776. checkRequestObjectInUse();
  1777. }
  1778. // 321485
  1779. String path = ((WebAppDispatcherContext) this.getDispatchContext()).getServletPath();
  1780. //PM59297 ...in case this servlet is a default servlet AND contains a ;jsessionid= which needs to be stripped off
  1781. //Starting 18.0.0.4, use SERVLET_PATH_FOR_DEFAULT_MAPPING instead.
  1782. if (path != null && (SERVLET_PATH_FOR_DEFAULT_MAPPING || WCCustomProperties.REMOVE_TRAILING_SERVLET_PATH_SLASH)) {
  1783. if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { //306998.15
  1784. logger.logp(Level.FINE, CLASS_NAME, "getServletPath", "stripping path -> " + path);
  1785. }
  1786. path = WebGroup.stripURL(path, false);
  1787. }
  1788. //PM59297
  1789. if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { //306998.15
  1790. logger.logp(Level.FINE, CLASS_NAME, "getServletPath", "path --> " + path);
  1791. }
  1792. return path;
  1793. }
  1794. /**
  1795. * Returns extra path information translated to a real file system path.
  1796. * Returns null if no extra path information was specified or translated
  1797. * path was unavailable. Same as the CGI variable PATH_TRANSLATED.
  1798. */
  1799. public String getPathTranslated()
  1800. {
  1801. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1802. checkRequestObjectInUse();
  1803. }
  1804. // 321485
  1805. String path = ((WebAppDispatcherContext) this.getDispatchContext()).getPathTranslated();
  1806. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1807. logger.logp(Level.FINE, CLASS_NAME,"getPathTranslated", " --> path " + path);
  1808. }
  1809. return path;
  1810. }
  1811. /**
  1812. * Returns the query string part of the servlet URI, or null if none.
  1813. * Same as the CGI variable QUERY_STRING.
  1814. */
  1815. public String getQueryString()
  1816. {
  1817. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1818. checkRequestObjectInUse();
  1819. }
  1820. SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance();
  1821. if (reqData.getQueryString()==null && !reqData.isQSSetExplicit())
  1822. if (_request != null && reqData != null) {
  1823. reqData.setQueryString(_request.getQueryString());
  1824. }
  1825. // 321485
  1826. String queryString = null;
  1827. if (reqData != null)
  1828. queryString = reqData.getQueryString();
  1829. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1830. logger.logp(Level.FINE, CLASS_NAME,"getQueryString", " queryString --> " + PasswordNullifier.nullifyParams(queryString));
  1831. }
  1832. return queryString;
  1833. }
  1834. public void setQueryString(String qs)
  1835. {
  1836. // 321485
  1837. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1838. logger.logp(Level.FINE, CLASS_NAME,"setQueryString", " queryString --> " + qs);
  1839. }
  1840. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1841. checkRequestObjectInUse();
  1842. }
  1843. SRTServletRequestThreadData.getInstance().setQueryString(qs);
  1844. }
  1845. /**
  1846. * Applies alias rules to the specified virtual path and returns the
  1847. * corresponding real path.
  1848. */
  1849. public String getRealPath(String path)
  1850. {
  1851. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1852. checkRequestObjectInUse();
  1853. }
  1854. // 321485
  1855. String realPath = ((WebAppDispatcherContext) this.getDispatchContext()).getRealPath(path);
  1856. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1857. logger.logp(Level.FINE, CLASS_NAME,"getRealPath", "path --> " + path + " realPath --> " + realPath);
  1858. }
  1859. return realPath;
  1860. }
  1861. /**
  1862. * Returns the name of the user making this request, or null if not
  1863. * known. Same as the CGI variable REMOTE_USER.
  1864. * This logic is delegatd to the registered IWebAppSecurityCollaborator.
  1865. */
  1866. public String getRemoteUser()
  1867. {
  1868. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1869. checkRequestObjectInUse();
  1870. }
  1871. String remoteUser = null;
  1872. Principal principal = getUserPrincipal();
  1873. if (principal == null) {
  1874. //remoteUser = null;
  1875. if (_request != null) {
  1876. remoteUser = _request.getRemoteUser();
  1877. }
  1878. } else {
  1879. remoteUser = principal.getName();
  1880. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  1881. logger.logp(Level.FINE, CLASS_NAME, "getRemoteUser", "(security enabled)");
  1882. }
  1883. }
  1884. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1885. logger.logp(Level.FINE, CLASS_NAME, "getRemoteUser", "user=" + remoteUser);
  1886. }
  1887. return remoteUser;
  1888. }
  1889. public String getRequestedSessionId()
  1890. {
  1891. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1892. checkRequestObjectInUse();
  1893. }
  1894. // 321485
  1895. String id = ((WebAppDispatcherContext) this.getDispatchContext()).getRequestedSessionId();
  1896. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1897. logger.logp(Level.FINE, CLASS_NAME,"getRequestedSessionId", "id --> " + id);
  1898. }
  1899. // return _connContext.getSessionAPISupport().getRequestedSessionId();
  1900. return id;
  1901. }
  1902. /**
  1903. * Returns the request URI as string.
  1904. */
  1905. public String getRequestURI()
  1906. {
  1907. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1908. checkRequestObjectInUse();
  1909. }
  1910. // Begin PK06988, strip session id of when url rewriting is enabled
  1911. SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance();
  1912. if (reqData != null && reqData.getRequestURI() == null)
  1913. {
  1914. String aURI = getEncodedRequestURI();
  1915. if (aURI == null)
  1916. return null;
  1917. else
  1918. reqData.setRequestURI(WebGroup.stripURL(aURI));
  1919. }
  1920. // 321485
  1921. String uri = null;
  1922. if (reqData != null)
  1923. uri = reqData.getRequestURI();
  1924. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1925. logger.logp(Level.FINE, CLASS_NAME,"getRequestURI", " uri --> " + uri);
  1926. }
  1927. return uri;
  1928. // End PK06988, strip session id of when url rewriting is enabled
  1929. }
  1930. /**
  1931. * Returns the host name of the server that received the request.
  1932. * Same as the CGI variable SERVER_NAME.
  1933. */
  1934. public String getServerName()
  1935. {
  1936. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1937. checkRequestObjectInUse();
  1938. }
  1939. String sName = this._request.getServerName();
  1940. // if (sName == null || sName.equalsIgnoreCase("localhost"))
  1941. if (sName == null || sName.length() == 0)
  1942. {
  1943. try
  1944. {
  1945. // get a real name for the local machine
  1946. sName = InetAddress.getLocalHost().getHostName();
  1947. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15
  1948. logger.logp(Level.FINE, CLASS_NAME,"getServerName", "using InetAddress --> " + sName);
  1949. }
  1950. }
  1951. catch (Throwable th)
  1952. {
  1953. // not much we can do here...just return what we have
  1954. }
  1955. }
  1956. // Begin 255189, Part 2
  1957. if (sName.charAt(0) != '[' && sName.indexOf(':') != -1)
  1958. sName = "[" + sName + "]";
  1959. // End 255189, Part 2
  1960. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15
  1961. logger.logp(Level.FINE, CLASS_NAME,"getServerName", "serverName --> " + sName);
  1962. }
  1963. return sName;
  1964. }
  1965. /**
  1966. * This method was created in VisualAge.
  1967. * @return javax.servlet.http.HttpSession
  1968. */
  1969. public HttpSession getSession()
  1970. {
  1971. return getSession(true);
  1972. }
  1973. /**
  1974. * Returns the session as an HttpSession. This does all of the "magic"
  1975. * to create the session if it doesn't already exist.
  1976. */
  1977. public HttpSession getSession(boolean create)
  1978. {
  1979. // 321485
  1980. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1981. logger.logp(Level.FINE, CLASS_NAME,"getSession", "create " + String.valueOf(create) + ", this -> "+this);
  1982. }
  1983. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1984. checkRequestObjectInUse();
  1985. }
  1986. // return _connContext.getSessionAPISupport().getSession(create);
  1987. return _requestContext.getSession(create, ((WebAppDispatcherContext) this.getDispatchContext()).getWebApp());
  1988. }
  1989. public boolean isRequestedSessionIdFromCookie()
  1990. { // 321485
  1991. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  1992. checkRequestObjectInUse();
  1993. }
  1994. boolean idFromCookie = ((WebAppDispatcherContext) this.getDispatchContext()).isRequestedSessionIdFromCookie();
  1995. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  1996. logger.logp(Level.FINE, CLASS_NAME,"isRequestedSessionIdFromCookie", " " + String.valueOf(idFromCookie));
  1997. }
  1998. //return _connContext.getSessionAPISupport().isRequestedSessionIdFromCookie();
  1999. return idFromCookie;
  2000. }
  2001. public boolean isRequestedSessionIdFromUrl()
  2002. {
  2003. return isRequestedSessionIdFromURL();
  2004. }
  2005. /**
  2006. * This method was created in VisualAge.
  2007. * @return boolean
  2008. */
  2009. public boolean isRequestedSessionIdFromURL()
  2010. {
  2011. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2012. checkRequestObjectInUse();
  2013. }
  2014. // 321485
  2015. boolean idFromURL = ((WebAppDispatcherContext) this.getDispatchContext()).isRequestedSessionIdFromURL();
  2016. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2017. logger.logp(Level.FINE, CLASS_NAME,"isRequestedSessionIdFromURL", " " + String.valueOf(idFromURL));
  2018. }
  2019. // return _connContext.getSessionAPISupport().isRequestedSessionIdFromURL();
  2020. return idFromURL;
  2021. }
  2022. /**
  2023. * If the session doesn't exist, then the Id that came
  2024. * in is invalid. If there is no sessionID in the request, then
  2025. * it's not valid.
  2026. */
  2027. public boolean isRequestedSessionIdValid()
  2028. {
  2029. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2030. checkRequestObjectInUse();
  2031. }
  2032. // 321485
  2033. boolean sessionInvalid = _requestContext.isRequestedSessionIdValid(((WebAppDispatcherContext) this.getDispatchContext()).getWebApp());
  2034. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2035. logger.logp(Level.FINE, CLASS_NAME,"isRequestedSessionIdValid", " " + String.valueOf(sessionInvalid));
  2036. }
  2037. return sessionInvalid;
  2038. }
  2039. // protected void removeHeader(String key) {
  2040. // //311717
  2041. // if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2042. // logger.logp(Level.FINE, CLASS_NAME,"removeHeader", " name --> " + key);
  2043. // }
  2044. // request.removeHeader(key);
  2045. // }
  2046. synchronized public void parseParameters()
  2047. {
  2048. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2049. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "");
  2050. }
  2051. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2052. checkRequestObjectInUse();
  2053. }
  2054. SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance();
  2055. if (reqData.getParameters() != null)
  2056. return;
  2057. //PM03928 - start
  2058. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2059. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "set _parametersRead");
  2060. }
  2061. _srtRequestHelper._parametersRead = true;
  2062. //PM03928 - end
  2063. try
  2064. {
  2065. reqData.setParameters(new Hashtable());
  2066. String ct = getContentType();
  2067. if (ct != null)
  2068. {
  2069. ct = ct.toLowerCase();
  2070. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  2071. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "Content type -->" + ct);
  2072. if (ct.startsWith("java-internal"))
  2073. {
  2074. String[] values = { ct };
  2075. reqData.getParameters().put(new String("Application specific data. Content-type "), values);
  2076. return;
  2077. }
  2078. }
  2079. }
  2080. catch (Exception npe)
  2081. {
  2082. com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(npe, "com.ibm.ws.webcontainer.srt.SRTServletRequest.parseParameters", "667", this);
  2083. logger.logp(Level.INFO, CLASS_NAME,"parseParameters", "Exception thrown during parsing of parameters", npe.toString());
  2084. return;
  2085. }
  2086. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2087. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "Content type is not java-internal");
  2088. }
  2089. String method = getMethod();
  2090. if (method.equalsIgnoreCase("post"))
  2091. // end pq70055: part 1
  2092. {
  2093. String contentType = getContentType();
  2094. if (contentType != null && contentType.startsWith("application/x-www-form-urlencoded"))
  2095. {
  2096. // Only read parameters from post data if app has not already go a reader or input stream.
  2097. // See servlet spec section 3.1.1 - When parameters are available.
  2098. if (this.multiReadPropertyEnabled) {
  2099. if (_srtRequestHelper._InputStreamClosed) {
  2100. ((SRTInputStream) this._in).restart();
  2101. }
  2102. }
  2103. if (!_srtRequestHelper._gotInputStream && !_srtRequestHelper._gotReader) {
  2104. try
  2105. {
  2106. reqData.setParameters(parsePostData());
  2107. }
  2108. catch (IOException io)
  2109. {
  2110. com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(io, "com.ibm.ws.webcontainer.srt.SRTServletRequest.parseParameters", "765", this);
  2111. logger.logp(Level.SEVERE, CLASS_NAME,"parseParameters", "Error.Parsing.Parameters", io);
  2112. }
  2113. finally
  2114. {
  2115. releaseInputStream(); //Let go of the InputStream now that we're done with it.
  2116. }
  2117. } else if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2118. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "ignoring post data gotReader="+_srtRequestHelper._gotReader + ", gotInputStream = " + _srtRequestHelper._gotInputStream);
  2119. }
  2120. if (reqData.getParameters() != null)
  2121. {
  2122. parseQueryStringList(); // 256836
  2123. }
  2124. }
  2125. if (contentType != null && contentType.startsWith("multipart/form-data"))
  2126. {
  2127. if (reqData.getParameters() != null)
  2128. {
  2129. parseQueryStringList(); //256836
  2130. try {
  2131. prepareMultipart();
  2132. StringBuffer value=new StringBuffer("");
  2133. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  2134. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "multipart size: "+_srtRequestHelper.multipartPartsHashMap.size());
  2135. for (String partName:_srtRequestHelper.multipartPartsHashMap.keySet()) {
  2136. ArrayList<Part> plist = (ArrayList)_srtRequestHelper.multipartPartsHashMap.get(partName); //91002
  2137. if (plist!=null) {
  2138. // Iterate over partList to check if they are valid to add as parameter
  2139. for (Iterator<Part> it = plist.iterator(); it.hasNext(); )
  2140. {
  2141. Part p = it.next();
  2142. value.setLength(0);
  2143. if (((SRTServletRequestPart)p).isFormField()) { //only add the parameter if it's not a file
  2144. InputStream partInputStream = p.getInputStream();
  2145. BufferedReader reader;
  2146. InputStreamReader streamReader;
  2147. if(WCCustomProperties.PARSE_PARTS_PARAMETERS_USING_REQUEST_ENCODING){
  2148. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  2149. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "Parsing multipart form fields using request encoding");
  2150. streamReader = new InputStreamReader(partInputStream, getReaderEncoding());
  2151. reader = new BufferedReader(streamReader);
  2152. }
  2153. else{
  2154. streamReader = new InputStreamReader(partInputStream);
  2155. reader = new BufferedReader(streamReader);
  2156. }
  2157. String line=null;
  2158. try {
  2159. if (!WCCustomProperties.KEEP_SEPARATOR_IN_MULTIPART_FORM_FIELDS) {
  2160. while ((line = reader.readLine()) != null) {
  2161. value.append(line);
  2162. }
  2163. }
  2164. else {
  2165. int read = -1;
  2166. int size = (int)p.getSize();
  2167. char[] buffer = new char[size];
  2168. read = streamReader.read(buffer, 0, size);
  2169. value.append(buffer, 0, read);
  2170. if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE))
  2171. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "Parsing multipart form field keeping line separators, partName-> "+partName+", partSize-> "+size+", read-> "+read);
  2172. }
  2173. }
  2174. finally {
  2175. partInputStream.close();
  2176. reader.close();
  2177. streamReader.close();
  2178. }
  2179. if(reqData.getParameters().containsKey(partName)){
  2180. String[] oldValues = (String[]) reqData.getParameters().get(partName);
  2181. String[] valArray = new String[oldValues.length+1];
  2182. System.arraycopy(oldValues, 0, valArray, 0, oldValues.length);
  2183. valArray[oldValues.length] = value.toString();
  2184. reqData.getParameters().put(partName,valArray);
  2185. }
  2186. else{
  2187. String[] values = { value.toString() };
  2188. reqData.getParameters().put(partName, values);
  2189. }
  2190. }
  2191. }
  2192. }
  2193. }
  2194. } //724365.2 Start
  2195. catch (UnsupportedOperationException uoe){
  2196. // take care of Portal or any other customer using own logic of handling Multipart form
  2197. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  2198. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "Error parsing parameters, maybe no MutliPartConfig defined in servlet. ", uoe);
  2199. }
  2200. }
  2201. catch (IllegalArgumentException iae) {
  2202. // take care of max number of parameters allowed
  2203. logger.logp(Level.SEVERE, CLASS_NAME,"parseParameters", "Error.Parsing.Parameters", iae);
  2204. throw iae;
  2205. }
  2206. catch (Exception e) {
  2207. if(WCCustomProperties.LOG_MULTIPART_EXCEPTIONS_ON_PARSEPARAMETER){
  2208. logger.logp(Level.SEVERE, CLASS_NAME,"parseParameters", "Error.Parsing.Parameters", e);
  2209. }
  2210. else{
  2211. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  2212. logger.logp(Level.FINE, CLASS_NAME,"parseParameters", "Error.Parsing.Parameters", e);
  2213. }
  2214. }
  2215. }
  2216. //724365.2 End
  2217. }
  2218. }
  2219. // begin pq70031: need to check if param list is empty in addition to null
  2220. if (( reqData.getParameters() == null || reqData.getParameters().isEmpty()))
  2221. // end pq70031
  2222. {
  2223. parseQueryStringList(); // 256836
  2224. }
  2225. }
  2226. // begin pq70055: part 2: failed to parse query string for head requests
  2227. else
  2228. {
  2229. parseQueryStringList(); // 256836
  2230. }
  2231. // end pq70055: part 2
  2232. if (reqData.getParameters() == null)
  2233. {
  2234. reqData.setParameters(new Hashtable());
  2235. }
  2236. }
  2237. // Added for servlet 3.1 support - method is overidden by SRTServletRequest31
  2238. protected Hashtable parsePostData() throws IOException {
  2239. if( getContentLength() > 0){
  2240. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2241. logger.logp(Level.FINE, CLASS_NAME,"parsePostData", "parsing post data based upon content length");
  2242. return RequestUtils.parsePostData(getContentLength(), getInputStream(), getReaderEncoding(), this.multiReadPropertyEnabled); // MultiRead
  2243. }
  2244. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2245. logger.logp(Level.FINE, CLASS_NAME,"parsePostData", "parsing post data based upon input stream (possibly chunked)");
  2246. return RequestUtils.parsePostData(getInputStream(), getReaderEncoding(),this.multiReadPropertyEnabled); // MultiRead
  2247. }
  2248. // Begin 256836
  2249. private void parseQueryStringList(){
  2250. //321485
  2251. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2252. logger.logp(Level.FINE, CLASS_NAME,"parseQueryStringList", "");
  2253. }
  2254. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2255. checkRequestObjectInUse();
  2256. }
  2257. SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance();
  2258. Hashtable tmpQueryParams = null;
  2259. LinkedList queryStringList = SRTServletRequestThreadData.getInstance().getQueryStringList();
  2260. if (queryStringList ==null || queryStringList.isEmpty()){ //258025
  2261. String queryString = getQueryString();
  2262. if (queryString != null && ((queryString.indexOf('=') != -1) || WCCustomProperties.ALLOW_QUERY_PARAM_WITH_NO_EQUAL))//PM35450
  2263. {
  2264. if (reqData.getParameters() == null || reqData.getParameters().isEmpty())// 258025
  2265. reqData.setParameters(RequestUtils.parseQueryString(getQueryString(), getReaderEncoding(true)));
  2266. else{
  2267. tmpQueryParams = RequestUtils.parseQueryString(getQueryString(), getReaderEncoding(true));
  2268. mergeQueryParams(tmpQueryParams);
  2269. }
  2270. }
  2271. }
  2272. else{
  2273. Iterator i = queryStringList.iterator();
  2274. QSListItem qsListItem = null;
  2275. String queryString;
  2276. while (i.hasNext()){
  2277. qsListItem = ((QSListItem) i.next());
  2278. queryString = qsListItem._qs;
  2279. // 321485
  2280. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2281. logger.logp(Level.FINE, CLASS_NAME,"parseQueryStringList", "queryString --> " + queryString);
  2282. }
  2283. if (qsListItem._qsHashtable != null)
  2284. mergeQueryParams(qsListItem._qsHashtable);
  2285. else if (queryString != null && ((queryString.indexOf('=') != -1) || WCCustomProperties.ALLOW_QUERY_PARAM_WITH_NO_EQUAL))//PM35450
  2286. {
  2287. if (reqData.getParameters() == null || reqData.getParameters().isEmpty())// 258025
  2288. {
  2289. qsListItem._qsHashtable = RequestUtils.parseQueryString(queryString, getReaderEncoding());
  2290. reqData.setParameters(qsListItem._qsHashtable);
  2291. qsListItem._qs = null;
  2292. }
  2293. else{
  2294. tmpQueryParams = RequestUtils.parseQueryString(queryString, getReaderEncoding());
  2295. qsListItem._qsHashtable = tmpQueryParams;
  2296. qsListItem._qs = null;
  2297. mergeQueryParams(tmpQueryParams);
  2298. }
  2299. }
  2300. }
  2301. }
  2302. }
  2303. // End 256836
  2304. private void mergeQueryParams(Hashtable tmpQueryParams)
  2305. {
  2306. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2307. logger.logp(Level.FINE, CLASS_NAME,"mergeQueryParams", "");
  2308. }
  2309. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2310. checkRequestObjectInUse();
  2311. }
  2312. SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance();
  2313. if (tmpQueryParams != null)
  2314. {
  2315. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2316. {
  2317. logger.logp(Level.FINE, CLASS_NAME,"mergeQueryParams", "tmpQueryParams.size() " + tmpQueryParams.size());
  2318. logger.logp(Level.FINE, CLASS_NAME,"mergeQueryParams", "tmpQueryParams " + tmpQueryParams);
  2319. }
  2320. Enumeration enumeration = tmpQueryParams.keys();
  2321. while (enumeration.hasMoreElements())
  2322. {
  2323. Object key = enumeration.nextElement();
  2324. // Check for QueryString parms with the same name
  2325. // pre-append to postdata values if necessary
  2326. if (reqData.getParameters() != null && reqData.getParameters().containsKey(key))
  2327. {
  2328. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2329. {
  2330. logger.logp(Level.FINE, CLASS_NAME,"mergeQueryParams", "_paramaters contains key " + key);
  2331. }
  2332. String postVals[] = (String[]) reqData.getParameters().get(key);
  2333. String queryVals[] = (String[]) tmpQueryParams.get(key);
  2334. String newVals[] = new String[postVals.length + queryVals.length];
  2335. int newValsIndex = 0;
  2336. for (int i = 0; i < queryVals.length; i++)
  2337. {
  2338. newVals[newValsIndex++] = queryVals[i];
  2339. }
  2340. for (int i = 0; i < postVals.length; i++)
  2341. {
  2342. newVals[newValsIndex++] = postVals[i];
  2343. }
  2344. reqData.getParameters().put(key, newVals);
  2345. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2346. {
  2347. logger.logp(Level.FINE, CLASS_NAME,"mergeQueryParams", "put key " + key + " into _parameters.");
  2348. }
  2349. }
  2350. else
  2351. {
  2352. if (reqData.getParameters() == null) // PK14900
  2353. reqData.setParameters(new Hashtable());// PK14900
  2354. reqData.getParameters().put(key, tmpQueryParams.get(key));
  2355. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2356. {
  2357. logger.logp(Level.FINE, CLASS_NAME,"mergeQueryParams", "put key " + key + " into _parameters. ");
  2358. }
  2359. }
  2360. }
  2361. }
  2362. }
  2363. // Begin 256836
  2364. private void removeQueryParams(Hashtable tmpQueryParams)
  2365. {
  2366. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2367. logger.logp(Level.FINE, CLASS_NAME,"removeQueryParams", "");
  2368. }
  2369. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2370. checkRequestObjectInUse();
  2371. }
  2372. SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance();
  2373. if (tmpQueryParams != null)
  2374. {
  2375. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2376. {
  2377. logger.logp(Level.FINE, CLASS_NAME,"removeQueryParams", "tmpQueryParams.size() " + tmpQueryParams.size());
  2378. logger.logp(Level.FINE, CLASS_NAME,"removeQueryParams", "tmpQueryParams " + tmpQueryParams);
  2379. }
  2380. Enumeration enumeration = tmpQueryParams.keys();
  2381. while (enumeration.hasMoreElements())
  2382. {
  2383. Object key = enumeration.nextElement();
  2384. // Check for QueryString parms with the same name
  2385. // pre-append to postdata values if necessary
  2386. if (reqData.getParameters().containsKey(key))
  2387. {
  2388. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2389. {
  2390. logger.logp(Level.FINE, CLASS_NAME,"removeQueryParams", "_paramaters contains key " + key);
  2391. }
  2392. String postVals[] = (String[]) reqData.getParameters().get(key);
  2393. String queryVals[] = (String[]) tmpQueryParams.get(key);
  2394. if (postVals.length-queryVals.length>0){
  2395. String newVals[] = new String[postVals.length - queryVals.length];
  2396. int newValsIndex = 0;
  2397. for (int i = queryVals.length; i < postVals.length; i++)
  2398. {
  2399. newVals[newValsIndex++] = postVals[i];
  2400. }
  2401. reqData.getParameters().put(key, newVals);
  2402. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2403. {
  2404. logger.logp(Level.FINE, CLASS_NAME,"removeQueryParams", "put key " + key + " into _parameters.");
  2405. }
  2406. }
  2407. else
  2408. reqData.getParameters().remove(key);
  2409. }
  2410. }
  2411. }
  2412. }
  2413. // End 256836
  2414. /**
  2415. * Close this request.
  2416. * This method must be called after the request has been processed.
  2417. */
  2418. public void finish() //280584.3 6021: Cleanup of defect 280584.2 WAS.webcontainer removed throws clause.
  2419. {
  2420. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2421. logger.logp(Level.FINE, CLASS_NAME,"finish", "entry");
  2422. }
  2423. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2424. checkRequestObjectInUse();
  2425. }
  2426. try
  2427. {
  2428. int length = getContentLength();
  2429. if (length > 0)
  2430. {
  2431. _in.close();
  2432. }
  2433. // begin 280584.3 6021: Cleanup of defect 280584.2 WAS.webcontainer: moved from finally block
  2434. else
  2435. {
  2436. this._in.finish();
  2437. }
  2438. // end 280584.3 6021: Cleanup of defect 280584.2 WAS.webcontainer
  2439. }
  2440. catch (IOException e)
  2441. {
  2442. com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, "com.ibm.ws.webcontainer.srt.SRTServletRequest.finish", "875", this);
  2443. // begin 280584.3 6021: Cleanup of defect 280584.2 WAS.webcontainer
  2444. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15
  2445. logger.logp(Level.FINE, CLASS_NAME,"finish", "Error occurred while finishing request", e);
  2446. }
  2447. // logger.logp(Level.SEVERE, CLASS_NAME,"finish", "IO.Error", e);
  2448. //se = new ServletException(nls.getString("Error.occured.while.finishing.request", "Error occurred while finishing request"), e);
  2449. // end 280584.3 6021: Cleanup of defect 280584.2 WAS.webcontainer
  2450. }
  2451. finally
  2452. {
  2453. cleanupFromFinish();
  2454. }
  2455. }
  2456. protected void cleanupFromFinish() {
  2457. this._srtRequestHelper = null;
  2458. this._request.clearHeaders();
  2459. this._request = null; // as SRTServletResponse.finish() does for _response
  2460. this._requestContext.finish();
  2461. SRTServletRequestThreadData.getInstance().init(null);
  2462. }
  2463. protected void processLocales()
  2464. {
  2465. //321485
  2466. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2467. logger.logp(Level.FINE, CLASS_NAME,"processLocales", "entry");
  2468. }
  2469. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2470. checkRequestObjectInUse();
  2471. }
  2472. if (_srtRequestHelper._localesProcessed)
  2473. return;
  2474. if (_srtRequestHelper._locales == null)
  2475. _srtRequestHelper._locales = new LinkedList();
  2476. this.setLocales(EncodingUtils.getLocales(this).iterator());
  2477. _srtRequestHelper._localesProcessed = true;
  2478. }
  2479. public RequestDispatcher getRequestDispatcher(String path)
  2480. {
  2481. // 321485
  2482. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2483. logger.logp(Level.FINE, CLASS_NAME,"getRequestDispatcher", " path --> " + path);
  2484. }
  2485. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2486. checkRequestObjectInUse();
  2487. }
  2488. return ((WebAppDispatcherContext) this.getDispatchContext()).getRequestDispatcher(path);
  2489. }
  2490. public String getContextPath()
  2491. {
  2492. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2493. checkRequestObjectInUse();
  2494. }
  2495. // 321485
  2496. String path = ((WebAppDispatcherContext) this.getDispatchContext()).getContextPath();
  2497. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2498. logger.logp(Level.FINE, CLASS_NAME,"getContextPath", " path --> " + path);
  2499. }
  2500. return path;
  2501. }
  2502. /**
  2503. * {@inheritDoc} Returns true if the user is authenticated and is in the
  2504. * specified role. False otherwise.
  2505. * This logic is delegatd to the registered IWebAppSecurityCollaborator.
  2506. */
  2507. public boolean isUserInRole(String role)
  2508. {
  2509. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2510. checkRequestObjectInUse();
  2511. }
  2512. boolean userInRole;
  2513. IWebAppSecurityCollaborator webAppSec = CollaboratorHelperImpl.getCurrentSecurityCollaborator();
  2514. if (webAppSec != null) {
  2515. userInRole = webAppSec.isUserInRole(role, this);
  2516. } else {
  2517. // No IWebAppSecurityCollaborator means no security, so not authenticated
  2518. userInRole = false;
  2519. }
  2520. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2521. logger.logp(Level.FINE, CLASS_NAME,"isUserInRole", " role --> " + role + " result --> " + String.valueOf(userInRole));
  2522. }
  2523. return userInRole;
  2524. }
  2525. /**
  2526. * {@inheritDoc} Returns the user Principal if authenticated, null otherwise.
  2527. * This logic is delegatd to the registered IWebAppSecurityCollaborator.
  2528. */
  2529. public java.security.Principal getUserPrincipal()
  2530. {
  2531. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2532. checkRequestObjectInUse();
  2533. }
  2534. IWebAppSecurityCollaborator webAppSec=null;
  2535. if (getDispatchContext()!=null && getDispatchContext().getWebApp() != null) {
  2536. webAppSec = CollaboratorHelperImpl.getCurrentSecurityCollaborator(getDispatchContext().getWebApp());
  2537. } else {
  2538. webAppSec = CollaboratorHelperImpl.getCurrentSecurityCollaborator();
  2539. }
  2540. if (webAppSec != null) {
  2541. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15
  2542. logger.logp(Level.FINE, CLASS_NAME,"getUserPrincipal", "calling getUserPrincipal on " + webAppSec.getClass().getName());
  2543. }
  2544. return webAppSec.getUserPrincipal();
  2545. } else {
  2546. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15
  2547. logger.logp(Level.FINE, CLASS_NAME,"getUserPrincipal", "returning null");
  2548. }
  2549. // No IWebAppSecurityCollaborator means no security, so no Principal
  2550. return null;
  2551. }
  2552. }
  2553. // begin pq71994
  2554. /**
  2555. * Save the state of the parameters before a call to include or forward.
  2556. */
  2557. public void pushParameterStack()
  2558. {
  2559. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15
  2560. logger.logp(Level.FINE, CLASS_NAME,"pushParameterStack", "entry");
  2561. }
  2562. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2563. checkRequestObjectInUse();
  2564. }
  2565. SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance();
  2566. if (reqData.getParameters() == null)
  2567. {
  2568. reqData.pushParameterStack(null);
  2569. } else
  2570. {
  2571. _paramStack.push(((Hashtable) reqData.getParameters()).clone());
  2572. }
  2573. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE) && reqData.getParameters() !=null) //306998.15
  2574. {
  2575. debugParams(reqData.getParameters());
  2576. }
  2577. }
  2578. /**
  2579. * Revert the state of the parameters which was saved before an include call
  2580. *
  2581. */
  2582. public void popParameterStack()
  2583. {
  2584. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2585. logger.logp(Level.FINE, CLASS_NAME,"popParameterStack", "entry");
  2586. }
  2587. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2588. checkRequestObjectInUse();
  2589. }
  2590. try
  2591. {
  2592. SRTServletRequestThreadData.getInstance().setParameters((Hashtable) _paramStack.pop());
  2593. } catch (java.util.EmptyStackException empty)
  2594. {
  2595. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2596. logger.logp(Level.FINE, CLASS_NAME,"popParameterStack", "Unable to remove item from stack", empty);
  2597. }
  2598. }
  2599. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE) && SRTServletRequestThreadData.getInstance().getParameters() !=null) //306998.15
  2600. {
  2601. debugParams(SRTServletRequestThreadData.getInstance().getParameters());
  2602. }
  2603. }
  2604. private void debugParams(Map parameters)
  2605. {
  2606. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2607. logger.logp(Level.FINE, CLASS_NAME,"debugParams", "entry");
  2608. }
  2609. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2610. checkRequestObjectInUse();
  2611. }
  2612. if (parameters != null)
  2613. {
  2614. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2615. logger.logp(Level.FINE, CLASS_NAME,"debugParams", "Only displaying value retrieved by request.getParameter(). More parameters may exist for parameter name");
  2616. }
  2617. Iterator enumeration = parameters.keySet().iterator();
  2618. while (enumeration.hasNext())
  2619. {
  2620. String paramName = (String) enumeration.next();
  2621. if(isSecure() || paramName.toUpperCase().indexOf("PASSWORD") > -1){
  2622. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2623. logger.logp(Level.FINE, CLASS_NAME,"debugParams", "paramName --> " + paramName +" paramValue [**********]");
  2624. }
  2625. }
  2626. else{
  2627. String paramValue = getParameter(paramName);
  2628. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2629. logger.logp(Level.FINE, CLASS_NAME,"debugParams", "paramName --> "+ paramName +" paramValue --> " + paramValue);
  2630. }
  2631. }
  2632. }
  2633. }
  2634. }
  2635. // end pq71994
  2636. // Begin 256836
  2637. public void removeQSFromList(){
  2638. //321485
  2639. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2640. logger.logp(Level.FINE, CLASS_NAME,"removeQSFromList", "entry");
  2641. }
  2642. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2643. checkRequestObjectInUse();
  2644. }
  2645. SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance();
  2646. LinkedList queryStringList = reqData.getQueryStringList();
  2647. if (queryStringList!=null&&!queryStringList.isEmpty()){
  2648. Map _tmpParameters = reqData.getParameters(); // Save off reference to current parameters
  2649. popParameterStack();
  2650. if (reqData.getParameters()==null&&_tmpParameters!=null) // Parameters above current inluce/forward were never parsed
  2651. {
  2652. reqData.setParameters(_tmpParameters);
  2653. Hashtable tmpQueryParams = ((QSListItem) queryStringList.getLast())._qsHashtable;
  2654. if (tmpQueryParams == null)
  2655. {
  2656. tmpQueryParams = RequestUtils.parseQueryString(((QSListItem) queryStringList.getLast())._qs, getReaderEncoding(true));
  2657. }
  2658. removeQueryParams(tmpQueryParams);
  2659. }
  2660. queryStringList.removeLast();
  2661. }
  2662. else{
  2663. //We need to pop parameter stack regardless of whether queryStringList is null
  2664. //because the queryString parameters could have been added directly to parameter list without
  2665. // adding ot the queryStringList
  2666. popParameterStack();
  2667. }
  2668. }
  2669. // Begin 249841, 256836
  2670. public void aggregateQueryStringParams(String additionalQueryString, boolean setQS)
  2671. {
  2672. // 321485
  2673. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2674. logger.logp(Level.FINE, CLASS_NAME,"aggregateQueryStringParams", "entry qs --> " + additionalQueryString + " set --> " + String.valueOf(setQS));
  2675. }
  2676. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2677. checkRequestObjectInUse();
  2678. }
  2679. QSListItem tmpQS = null;
  2680. SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance();
  2681. if (reqData.getParameters() == null)
  2682. {
  2683. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2684. logger.logp(Level.FINE, CLASS_NAME,"aggregateQueryStringParams", "The paramater stack is currently null");
  2685. // Begin 258025, Part 2
  2686. LinkedList queryStringList = SRTServletRequestThreadData.getInstance().getQueryStringList();
  2687. if (queryStringList == null || queryStringList.isEmpty())
  2688. {
  2689. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2690. logger.logp(Level.FINE, CLASS_NAME,"aggregateQueryStringParams", "The queryStringList is empty");
  2691. if (queryStringList == null)
  2692. queryStringList = new LinkedList();
  2693. if (getQueryString()!=null){
  2694. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) //306998.15
  2695. logger.logp(Level.FINE, CLASS_NAME,"aggregateQueryStringParams", "getQueryString will be added first in the QSList wih value->"+getQueryString());
  2696. tmpQS = new QSListItem(getQueryString(), null);
  2697. queryStringList.add(tmpQS);
  2698. }
  2699. SRTServletRequestThreadData.getInstance().setQueryStringList(queryStringList);
  2700. }
  2701. // End 258025, Part 2
  2702. if (additionalQueryString !=null){
  2703. tmpQS = new QSListItem(additionalQueryString, null);
  2704. queryStringList.add(tmpQS);
  2705. }
  2706. }
  2707. if (setQS){
  2708. setQueryString(additionalQueryString);
  2709. }
  2710. // if _parameters is not null, then this is part of a forward or include...add the additional query parms
  2711. // if _parameters is null, then the string will be parsed if needed
  2712. if (reqData.getParameters() != null && additionalQueryString != null)
  2713. {
  2714. Hashtable parameters = RequestUtils.parseQueryString(additionalQueryString, getReaderEncoding(true));
  2715. // end 249841, 256836
  2716. String[] valArray;
  2717. for (Enumeration e = parameters.keys(); e.hasMoreElements();)
  2718. {
  2719. String key = (String) e.nextElement();
  2720. String[] newVals = (String[]) parameters.get(key);
  2721. // Check to see if a parameter with the key already exists
  2722. // and prepend the values since QueryString takes precedence
  2723. //
  2724. if (reqData.getParameters().containsKey(key))
  2725. {
  2726. String[] oldVals = (String[]) reqData.getParameters().get(key);
  2727. Vector v = new Vector();
  2728. for (int i = 0; i < newVals.length; i++)
  2729. {
  2730. v.add(newVals[i]);
  2731. }
  2732. for (int i = 0; i < oldVals.length; i++)
  2733. {
  2734. // 249841, do not check to see if values already exist
  2735. v.add(oldVals[i]);
  2736. }
  2737. valArray = new String[v.size()];
  2738. v.toArray(valArray);
  2739. reqData.getParameters().put(key, valArray);
  2740. }
  2741. else
  2742. {
  2743. reqData.getParameters().put(key, newVals);
  2744. }
  2745. }
  2746. }
  2747. }
  2748. // LIDB1234.4 - added method below
  2749. /**
  2750. * Returns a java.util.Map of the parameters of this request. Request parameters are extra
  2751. * information sent with the request. For HTTP servlets, parameters are contained in the
  2752. * query string or posted form data.
  2753. *
  2754. * @return an immutable Map object containing parameter names as keys and parameter values
  2755. * as map values. The keys in the parameter map are of type String. The values
  2756. * in the parameter map are of type String array.
  2757. *
  2758. * @since Servlet 2.3
  2759. */
  2760. public java.util.Map getParameterMap()
  2761. {
  2762. //321485
  2763. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2764. logger.logp(Level.FINE, CLASS_NAME,"getParameterMap", "");
  2765. }
  2766. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2767. checkRequestObjectInUse();
  2768. }
  2769. // if the parameters haven't been parsed, parse them
  2770. parseParameters();
  2771. // return the map
  2772. return (Map) SRTServletRequestThreadData.getInstance().getParameters();
  2773. }
  2774. // LIDB1234.4 - added method below
  2775. /**
  2776. * Reconstructs the URL the client used to make the request. The returned URL contains
  2777. * a protocol, server name, port number, and server path, but it does not include query
  2778. * string parameters.
  2779. *
  2780. * Because this method returns a StringBuffer, not a string, you can modify the URL
  2781. * easily, for example, to append query parameters.
  2782. *
  2783. * This method is useful for creating redirect messages and for reporting errors.
  2784. *
  2785. * @return a StringBuffer object containing the reconstructed URL
  2786. *
  2787. * @since Servlet 2.3
  2788. */
  2789. public java.lang.StringBuffer getRequestURL()
  2790. {
  2791. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2792. checkRequestObjectInUse();
  2793. }
  2794. StringBuffer fullURL = new StringBuffer();
  2795. // get the scheme and port up front for later use
  2796. String scheme = getScheme();
  2797. int port = getServerPort();
  2798. // append the scheme and server name
  2799. fullURL.append(scheme);
  2800. fullURL.append("://");
  2801. fullURL.append(getServerName());
  2802. // append the port if not the default one for the scheme
  2803. if ((scheme.equals("http") && port != 80) || (scheme.equals("https") && port != 443))
  2804. {
  2805. fullURL.append(':');
  2806. fullURL.append(getServerPort());
  2807. }
  2808. // append the uri
  2809. // PK22688 start
  2810. // fullURL.append(getRequestURI());
  2811. fullURL.append(getEncodedRequestURI());
  2812. // PK22688 end
  2813. // 321485
  2814. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2815. logger.logp(Level.FINE, CLASS_NAME,"getRequestURL", "url --> " + fullURL);
  2816. }
  2817. return fullURL;
  2818. }
  2819. // LIDB1234.6 - added method below
  2820. /**
  2821. * Overrides the name of the character encoding used in the body of this request. This
  2822. * method must be called prior to reading request parameters or reading input using
  2823. * getReader().
  2824. *
  2825. * @param encoding a String containing the name of the character encoding
  2826. *
  2827. * @throws java.io.UnsupportedEncodingException if this is not a valid encoding
  2828. */
  2829. public byte[] getSSLId()
  2830. {
  2831. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2832. checkRequestObjectInUse();
  2833. }
  2834. // 321485
  2835. byte[] id = _request.getSSLSessionID();
  2836. return id;
  2837. }
  2838. /**
  2839. * @return
  2840. */
  2841. private String getSSLSessionId() {
  2842. //PI75166
  2843. byte[] id = getSSLId();
  2844. String value = null;
  2845. if (id!=null) {
  2846. value = IDGeneratorImpl.convertSessionIdBytesToSessionId(id, SessionManagerConfigBase.getSessionIDLength());
  2847. }
  2848. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  2849. logger.logp(Level.FINE, CLASS_NAME,"getSSLSessionId", "id -->" + value);
  2850. }
  2851. return value;
  2852. }
  2853. public byte[] getCookieValueAsBytes(String cookieName) {
  2854. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2855. checkRequestObjectInUse();
  2856. }
  2857. // 321485
  2858. byte[] cookieValue = _request.getCookieValue(cookieName);
  2859. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2860. logger.logp(Level.FINE, CLASS_NAME,"getCookieValueAsBytes", " name --> " + cookieName + " value --> " + (cookieValue!=null?new String(cookieValue):""));
  2861. }
  2862. return cookieValue;
  2863. }
  2864. /**
  2865. * Get the values for the cookie specified.
  2866. * @param name the cookie name
  2867. * @return List of values associated with this cookie name.
  2868. */
  2869. public List getAllCookieValues(String cookieName){
  2870. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2871. checkRequestObjectInUse();
  2872. }
  2873. List cookieValues = _request.getAllCookieValues(cookieName);
  2874. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2875. logger.logp(Level.FINE, CLASS_NAME,"getAllCookieValues", " name --> " + cookieName + " values --> " + cookieValues);
  2876. }
  2877. return cookieValues;
  2878. }
  2879. /**
  2880. * Returns the cookie that is been set in this request.
  2881. * Need this to handle the case where session is created
  2882. * in a request and forwarded to another or viceversa. Applies
  2883. * to includes to
  2884. */
  2885. public String getUpdatedSessionId()
  2886. {
  2887. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2888. checkRequestObjectInUse();
  2889. }
  2890. // 321485
  2891. String id = _srtRequestHelper._updatedSessionId;
  2892. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2893. logger.logp(Level.FINE, CLASS_NAME,"getUpdatedSessionId", " id --> " + id);
  2894. }
  2895. return id;
  2896. }
  2897. public void setSessionId(String id)
  2898. {
  2899. // 321485
  2900. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2901. logger.logp(Level.FINE, CLASS_NAME,"setSessionId", " id --> " + id);
  2902. }
  2903. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2904. checkRequestObjectInUse();
  2905. }
  2906. _srtRequestHelper._updatedSessionId = id;
  2907. }
  2908. // LIDB4395 cmd start
  2909. public Object getSessionAffinityContext()
  2910. {
  2911. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2912. checkRequestObjectInUse();
  2913. }
  2914. // 321485
  2915. Object sac = _srtRequestHelper._sessionAffinityContext;
  2916. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2917. logger.logp(Level.FINE, CLASS_NAME,"getSessionAffinityContext", " sac --> " + sac);
  2918. }
  2919. return sac;
  2920. }
  2921. public void setSessionAffinityContext(Object sac)
  2922. {
  2923. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2924. checkRequestObjectInUse();
  2925. }
  2926. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2927. logger.logp(Level.FINE, CLASS_NAME,"setSessionAffinityContext", " sac --> " + sac);
  2928. }
  2929. _srtRequestHelper._sessionAffinityContext = sac;
  2930. }
  2931. // LIDB4395 cmd end
  2932. public String getEncodedRequestURI()
  2933. {
  2934. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2935. checkRequestObjectInUse();
  2936. }
  2937. // 321485
  2938. String uri = null;
  2939. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2940. logger.logp(Level.FINE, CLASS_NAME,"getEncodedRequestURI", "");
  2941. }
  2942. if (getDispatchContext() == null)
  2943. uri = _request.getRequestURI();
  2944. else
  2945. uri = getDispatchContext().getRequestURI();
  2946. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2947. logger.logp(Level.FINE, CLASS_NAME,"getEncodedRequestURI", " uri --> " + uri);
  2948. }
  2949. return uri;
  2950. }
  2951. /**
  2952. * @return
  2953. */
  2954. public SRTRequestContext getRequestContext()
  2955. {
  2956. //321485
  2957. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2958. logger.logp(Level.FINE, CLASS_NAME,"getRequestContext", "");
  2959. }
  2960. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2961. checkRequestObjectInUse();
  2962. }
  2963. return _requestContext;
  2964. }
  2965. /**
  2966. * Returns a boolean that indicates if collaborators are
  2967. * running. Session Manager needs this to suppress throwing
  2968. * UnauthorizedSessionRequestExceptions when getSession is
  2969. * called by collaborators, rather than the application.
  2970. * PK01801
  2971. */
  2972. public boolean getRunningCollaborators()
  2973. {
  2974. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2975. checkRequestObjectInUse();
  2976. }
  2977. // 321485
  2978. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2979. logger.logp(Level.FINE, CLASS_NAME,"getRunningCollaborators", " value --> " + String.valueOf(_runningCollaborators));
  2980. }
  2981. return _runningCollaborators;
  2982. }
  2983. public void setRunningCollaborators(boolean runningCollaborators)
  2984. {
  2985. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2986. checkRequestObjectInUse();
  2987. }
  2988. // 321485
  2989. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  2990. logger.logp(Level.FINE, CLASS_NAME,"setRunningCollaborators", " value --> " + String.valueOf(_runningCollaborators));
  2991. }
  2992. this._runningCollaborators = runningCollaborators;
  2993. }
  2994. public void destroy() {
  2995. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  2996. logger.logp(Level.FINE, CLASS_NAME,"destroy", " entry");
  2997. }
  2998. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  2999. checkRequestObjectInUse();
  3000. }
  3001. this._requestContext.destroy();
  3002. this._requestContext = null;
  3003. this._connContext = null;
  3004. this._dispatchContext = null;
  3005. this._srtRequestHelper = null;
  3006. this._paramStack = null;
  3007. this._in = null;
  3008. this._setInputStreamContentType = null; // PK57679
  3009. this._setInputStreamContentLength = -1; // PK57679
  3010. this._setInputDataStreamCalled = false; // 516233
  3011. this.usedStartAsyncNoParameters = false; // PI43752
  3012. if(this._request instanceof IPoolable){
  3013. ((IPoolable) this._request).destroy();
  3014. }
  3015. this._request = null;
  3016. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3017. logger.logp(Level.FINE, CLASS_NAME,"destroy", " exit");
  3018. }
  3019. }
  3020. protected WSServletInputStream createInputStream() {
  3021. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
  3022. logger.logp(Level.FINE, CLASS_NAME,"createInputStream", " entry");
  3023. }
  3024. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3025. checkRequestObjectInUse();
  3026. }
  3027. // LIBERTY - Switched from HttpInputStream to SRTInputStream because of Sun
  3028. // code.
  3029. return new SRTInputStream();
  3030. // return new HttpInputStream();
  3031. }
  3032. private class SRTServletRequestHelper implements Cloneable{
  3033. // objects requiring cloning
  3034. // ==========================
  3035. private Hashtable _privateAttributes = null; //268366, PERF: 3% regression in PingServlet
  3036. private Map _attributes = new HashMap();
  3037. // ==========================
  3038. // instance variables not needing cloning
  3039. // ==========================
  3040. private boolean _cookiesParsed = false;
  3041. private String _updatedSessionId;
  3042. private Object _sessionAffinityContext; // cmd LIDB4395
  3043. private Cookie[] _cookies;
  3044. private boolean _localesProcessed = false;
  3045. private String _readerEncoding = null;
  3046. private String _readerEncodingInvalidIgnored = null;
  3047. private String _characterEncoding = null;
  3048. private boolean _gotReader = false;
  3049. private boolean _gotInputStream = false;
  3050. private boolean _InputStreamClosed = false; // MultiRead
  3051. private String _method = null;
  3052. private boolean _parametersRead = false; //PM03928
  3053. private DispatcherType dispatcherType = DispatcherType.REQUEST;
  3054. // ==========================
  3055. // other objects not needing cloning
  3056. // =================================
  3057. private BufferedReader _reader = null;
  3058. private LinkedList _locales = null;
  3059. private boolean asyncSupported=true;
  3060. private com.ibm.wsspi.webcontainer.servlet.AsyncContext asyncContext;
  3061. private List<AsyncListenerEntry> asyncListenerEntryList;
  3062. public long _asyncTimeout=0;
  3063. public boolean multipartRequestInputStreamRead = false;
  3064. public Exception multipartException=null;
  3065. public boolean multipartISEException=false;
  3066. public LinkedHashMap<String, ArrayList<Part>> multipartPartsHashMap = null; //91002
  3067. private boolean asyncStarted=false;
  3068. private List<String> resourcesNotSupportAsync = null; //141092
  3069. // =================================
  3070. protected Object clone() throws CloneNotSupportedException {
  3071. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3072. logger.logp(Level.FINE, CLASS_NAME,"clone", "SRTRequestHelper.clone entry");
  3073. }
  3074. SRTServletRequestHelper _clonedHelper = null;
  3075. _clonedHelper = (SRTServletRequestHelper) super.clone();
  3076. if (this._privateAttributes != null)
  3077. _clonedHelper._privateAttributes = (Hashtable) _privateAttributes.clone();
  3078. if (this._attributes != null)
  3079. _clonedHelper._attributes = (HashMap) ((HashMap) _attributes).clone();
  3080. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3081. logger.logp(Level.FINE, CLASS_NAME,"clone", "SRTRequestHelper.clone original -->" + this +" cloned -->" + _clonedHelper);
  3082. }
  3083. return _clonedHelper;
  3084. }
  3085. }
  3086. // Begin 256836
  3087. class QSListItem
  3088. {
  3089. String _qs = null;
  3090. Hashtable _qsHashtable = null;
  3091. QSListItem(String qs, Hashtable qsHashtable){
  3092. _qs = qs;
  3093. _qsHashtable = qsHashtable;
  3094. }
  3095. }
  3096. // End 256836
  3097. public void removeHeader(String header) {
  3098. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3099. checkRequestObjectInUse();
  3100. }
  3101. this._request.removeHeader(header);
  3102. }
  3103. public AsyncContext getAsyncContext() {
  3104. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3105. checkRequestObjectInUse();
  3106. }
  3107. if (_srtRequestHelper.asyncContext==null)
  3108. throw new IllegalStateException();
  3109. return _srtRequestHelper.asyncContext;
  3110. }
  3111. public void closeResponseOutput() {
  3112. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3113. checkRequestObjectInUse();
  3114. }
  3115. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3116. logger.entering(CLASS_NAME,"closeResponseOutput");
  3117. }
  3118. IResponse iResponse = getResponse().getIResponse();
  3119. getResponse().closeResponseOutput(true); // WAS is false
  3120. // start added WAS merge
  3121. finishAndDestroyConnectionContext();
  3122. //wait until after the finishConnection is called to release the channel link.
  3123. //you may need to read in the remaining bits from the input stream
  3124. WebContainerRequestState reqState = WebContainerRequestState.getInstance(true);
  3125. if (! reqState.isCompleted()) {
  3126. iResponse.releaseChannel();
  3127. if (reqState.getCurrentThreadsIExtendedRequest()==this) {
  3128. WebContainerRequestState.getInstance(true).setCompleted(true);
  3129. }
  3130. }
  3131. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3132. logger.exiting(CLASS_NAME,"closeResponseOutput");
  3133. }
  3134. }
  3135. public void finishAndDestroyConnectionContext() {
  3136. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3137. checkRequestObjectInUse();
  3138. }
  3139. // end added WAS merge
  3140. this._connContext.finishConnection();
  3141. this._connContext.destroy();
  3142. }
  3143. //Defect 632800
  3144. //we need to keep track of the error dispatch type separately from the
  3145. //include or forward dispatch type so that error dispatches still behave
  3146. //the same based off of whether it was a forward or include, but also
  3147. //the ServletRequest.getDispatcherType must return error regardless of
  3148. //whether include or forward was used.
  3149. public void setDispatcherType(DispatcherType dispatcherType) {
  3150. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  3151. logger.logp(Level.FINE, CLASS_NAME,"setDispatcherType","dispatcherType->"+dispatcherType);
  3152. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3153. checkRequestObjectInUse();
  3154. }
  3155. this._srtRequestHelper.dispatcherType = dispatcherType;
  3156. }
  3157. public DispatcherType getDispatcherType() {
  3158. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  3159. logger.logp(Level.FINE, CLASS_NAME,"getDispatcherType","this ->" + this);
  3160. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3161. checkRequestObjectInUse();
  3162. }
  3163. //PI58920
  3164. if (this._srtRequestHelper.dispatcherType == DispatcherType.ERROR){
  3165. return this._srtRequestHelper.dispatcherType;
  3166. }
  3167. if (this.getDispatchContext() != null){
  3168. if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  3169. logger.logp(Level.FINE, CLASS_NAME,"getDispatcherType","from _dispatchContext");
  3170. return this.getDispatchContext().getDispatcherType();
  3171. }
  3172. if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  3173. logger.logp(Level.FINE, CLASS_NAME,"getDispatcherType","from _srtRequestHelper");
  3174. //PI58920
  3175. return this._srtRequestHelper.dispatcherType;
  3176. }
  3177. //Defect 632800
  3178. @Override
  3179. public ServletContext getServletContext() {
  3180. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3181. checkRequestObjectInUse();
  3182. }
  3183. return this.getDispatchContext().getWebApp().getFacade();
  3184. }
  3185. //141092
  3186. private void addNoAsyncSupportedResources(String noAsyncResource){
  3187. if (this._srtRequestHelper.resourcesNotSupportAsync == null)
  3188. this._srtRequestHelper.resourcesNotSupportAsync = Collections.synchronizedList(new ArrayList<String>());
  3189. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3190. logger.logp(Level.FINE, CLASS_NAME,"addNoAsyncSupportedResourceList", "resource " + noAsyncResource + " does not support async, this->"+this);
  3191. }
  3192. this._srtRequestHelper.resourcesNotSupportAsync.add(noAsyncResource);
  3193. }
  3194. private List<String> getNoAsyncSupportedResourcesList(){
  3195. return this._srtRequestHelper.resourcesNotSupportAsync;
  3196. }
  3197. //141092
  3198. @Override
  3199. public boolean isAsyncStarted() {
  3200. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3201. checkRequestObjectInUse();
  3202. }
  3203. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3204. logger.logp(Level.FINE, CLASS_NAME,"isAsyncStarted", "value = " + this._srtRequestHelper.asyncStarted + ", this->"+this);
  3205. }
  3206. return this._srtRequestHelper.asyncStarted;
  3207. }
  3208. @Override
  3209. public boolean isAsyncSupported() {
  3210. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3211. checkRequestObjectInUse();
  3212. }
  3213. return this._srtRequestHelper.asyncSupported ;
  3214. }
  3215. @Override
  3216. public void setAsyncSupported(boolean asyncSupported) {
  3217. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3218. checkRequestObjectInUse();
  3219. }
  3220. //141092
  3221. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3222. logger.logp(Level.FINE, CLASS_NAME,"setAsyncSupported", " asyncSupported -> " + asyncSupported);
  3223. }
  3224. if (!asyncSupported){
  3225. WebContainerRequestState reqState = WebContainerRequestState.getInstance(false);
  3226. if (reqState != null){
  3227. String resource = (String) reqState.getAttribute("resourceNotSupportAsync");
  3228. if (resource != null){
  3229. addNoAsyncSupportedResources(resource);
  3230. reqState.removeAttribute("resourceNotSupportAsync");
  3231. }
  3232. }
  3233. }
  3234. //141092
  3235. this._srtRequestHelper.asyncSupported = asyncSupported;
  3236. }
  3237. @Override
  3238. public AsyncContext startAsync() {
  3239. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3240. checkRequestObjectInUse();
  3241. }
  3242. final IExtendedResponse iExtendedResponse = this.getResponse();
  3243. this.usedStartAsyncNoParameters = true; // PI43752
  3244. return startAsync(this,iExtendedResponse);
  3245. }
  3246. @Override
  3247. public AsyncContext startAsync(ServletRequest servletRequest,
  3248. ServletResponse servletResponse) {
  3249. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3250. checkRequestObjectInUse();
  3251. }
  3252. WebContainerRequestState reqState = WebContainerRequestState.getInstance(true);
  3253. //NOTE: We should actually be even more strict by determining if we've committed and closed the response,
  3254. //but we do not commit and close the response in all cases that we should today.
  3255. if (reqState.isCompleted()||(_srtRequestHelper.asyncContext!=null&&_srtRequestHelper.asyncContext.isCompletePending())){
  3256. throw new AsyncIllegalStateException(nls.getString("trying.to.do.startAsync.after.a.complete"));
  3257. } else if (reqState.getCurrentThreadsIExtendedRequest()!=this){
  3258. throw new AsyncIllegalStateException(nls.getString("not.called.from.within.the.context.of.a.dispatch.for.this.request"));
  3259. } else if (reqState.isAsyncMode()){
  3260. throw new AsyncIllegalStateException(nls.getString("cannot.call.startAsync.multiple.times.within.same.dispatch"));
  3261. } else if (!isAsyncSupported()) {
  3262. //141092
  3263. List<String> resourcesList = getNoAsyncSupportedResourcesList();
  3264. if (resourcesList != null && !resourcesList.isEmpty()){
  3265. StringBuilder noAsyncSupportedResources = new StringBuilder();
  3266. for (String s : resourcesList){
  3267. noAsyncSupportedResources.append(s + " ");
  3268. }
  3269. logger.logp(Level.SEVERE, CLASS_NAME,"startAsync", "resource.does.not.support.async", noAsyncSupportedResources.toString());
  3270. }
  3271. //141092
  3272. throw new AsyncIllegalStateException(nls.getString("request.does.not.support.async.servlet.processing"));
  3273. }
  3274. //The listeners will not be added at this point any more due to spec changes
  3275. //or they will be about ready to get cleared out of the current list of listeners.
  3276. //Either way, they don't need to be invoked.
  3277. // if (_srtRequestHelper.asyncListenerEntryList!=null){
  3278. // initializeAsyncListeners(servletRequest,servletResponse);
  3279. // }
  3280. //
  3281. if (_srtRequestHelper.asyncContext!=null){
  3282. _srtRequestHelper.asyncContext.initialize();
  3283. }
  3284. else {
  3285. _srtRequestHelper.asyncContext = com.ibm.ws.webcontainer.WebContainer.getWebContainer().getAsyncContextFactory().getAsyncContext(this,this.getResponse(),this.getWebAppDispatcherContext());
  3286. }
  3287. _srtRequestHelper.asyncContext.setRequestAndResponse(servletRequest, servletResponse);
  3288. //PI43752 start
  3289. if(WCCustomProperties.SET_ASYNC_DISPATCH_REQUEST_URI && !this.usedStartAsyncNoParameters && servletRequest instanceof HttpServletRequest){
  3290. ((AsyncContextImpl) _srtRequestHelper.asyncContext).setDispatchURI(((HttpServletRequest) servletRequest).getRequestURI());
  3291. }
  3292. //PI43752 end
  3293. _request.startAsync();
  3294. this.setAsyncStarted(true);
  3295. reqState.setAsyncMode(true);
  3296. reqState.setAsyncContext(_srtRequestHelper.asyncContext);
  3297. usedStartAsyncNoParameters = false;
  3298. return _srtRequestHelper.asyncContext;
  3299. }
  3300. //
  3301. // private void initializeAsyncListeners(ServletRequest servletRequest,
  3302. // ServletResponse servletResponse) {
  3303. // for (AsyncListenerEntry asyncListenerEntry:_srtRequestHelper.asyncListenerEntryList){
  3304. // if (!asyncListenerEntry.isInitialized()){
  3305. // asyncListenerEntry.init(servletRequest,servletResponse);
  3306. // }
  3307. // }
  3308. // }
  3309. @Override
  3310. public boolean authenticate(HttpServletResponse arg0) throws ServletException, IOException{
  3311. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3312. checkRequestObjectInUse();
  3313. }
  3314. WebApp webApp = this.getDispatchContext().getWebApp();
  3315. return webApp.getCollaboratorHelper().getSecurityCollaborator().authenticate(this,arg0);
  3316. }
  3317. @Override
  3318. public Part getPart(String arg0) throws ServletException, IOException {
  3319. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3320. checkRequestObjectInUse();
  3321. }
  3322. prepareMultipart();
  3323. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3324. logger.logp(Level.FINE, CLASS_NAME,"getPart","--> ["+ arg0 +" ]");
  3325. }
  3326. ArrayList<Part> values = (ArrayList)_srtRequestHelper.multipartPartsHashMap.get(arg0); //91002
  3327. if(values != null && values.size() > 0){
  3328. return values.get(0);
  3329. }
  3330. else
  3331. return null; // possible if part is never added to the map.
  3332. }
  3333. @Override
  3334. public Collection<Part> getParts() throws ServletException, IOException {
  3335. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3336. checkRequestObjectInUse();
  3337. }
  3338. prepareMultipart();
  3339. //91002
  3340. Collection<ArrayList<Part>> coll = _srtRequestHelper.multipartPartsHashMap.values();
  3341. Collection<Part> parts = new ArrayList<Part>();
  3342. for (Iterator<ArrayList<Part>> it = coll.iterator(); it.hasNext(); )
  3343. {
  3344. ArrayList<Part> p = it.next();
  3345. parts.addAll(p);
  3346. }
  3347. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3348. logger.logp(Level.FINE, CLASS_NAME,"getParts","size -->" + parts.size());
  3349. }
  3350. return parts;
  3351. }
  3352. protected void prepareMultipart() throws ServletException, IOException {
  3353. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3354. checkRequestObjectInUse();
  3355. }
  3356. if (!_srtRequestHelper.multipartRequestInputStreamRead) {
  3357. if (_srtRequestHelper.multipartPartsHashMap==null) {
  3358. _srtRequestHelper.multipartPartsHashMap = new LinkedHashMap<String, ArrayList<Part>>(); //91002
  3359. }
  3360. if (this.getContentType()!=null && this.getContentType().startsWith("multipart/form-data")) {
  3361. int contentLength=this.getContentLength();
  3362. IServletConfig multiPartServletConfig = this.getDispatchContext().getCurrentServletReference().getServletConfig();
  3363. MultipartConfigElement mce = multiPartServletConfig.getMultipartConfig();
  3364. if (mce==null) {
  3365. throw new UnsupportedOperationException(nls.getString("multipart.no.multipart.config"));
  3366. }
  3367. parseMultipart(multiPartServletConfig, mce.getFileSizeThreshold(), mce.getLocation(), mce.getMaxFileSize(), mce.getMaxRequestSize());//PI75528
  3368. _srtRequestHelper.multipartRequestInputStreamRead=true;
  3369. } else {
  3370. //since getParameter wouldn't get into this method when the request isn't multipart, we don't need to store the exception.
  3371. throw new ServletException(nls.getString("multipart.request.not.multipart"));
  3372. }
  3373. }
  3374. }
  3375. private void parseMultipart(IServletConfig multiPartServletConfig, int fileThreshold, String location, long maxFileSize, long maxRequestSize) throws IOException {
  3376. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3377. logger.logp(Level.FINE, CLASS_NAME,"parseMultipart"," "+ multiPartServletConfig.getServletName()+" ["+ fileThreshold +", "+location+ ", " + maxFileSize+" , " + maxRequestSize+"]"); //PI75528
  3378. }
  3379. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3380. checkRequestObjectInUse();
  3381. }
  3382. File uploadFile = multiPartServletConfig.getMultipartBaseLocation();
  3383. if (uploadFile==null) {
  3384. //handle new requirement for location to be found relative to temp dir
  3385. WebApp webapp =getDispatchContext().getWebApp();
  3386. File tmpLocation=(File)webapp.getAttribute("javax.servlet.context.tempdir");
  3387. if (location==null || location.length()==0) {
  3388. uploadFile = tmpLocation;
  3389. } else {
  3390. if (System.getSecurityManager() != null) {
  3391. final String finalLocation=location;
  3392. final File finalTmpLocation=tmpLocation;
  3393. uploadFile = AccessController.doPrivileged(new java.security.PrivilegedAction<File>() {
  3394. public File run() {
  3395. File innerUploadFile = new File(finalLocation);
  3396. if (!innerUploadFile.isAbsolute()) {
  3397. //if it is not an absolute path, make it relative to the tmp dir
  3398. innerUploadFile = new File(finalTmpLocation, finalLocation);
  3399. if (!innerUploadFile.exists()) {
  3400. //create it
  3401. innerUploadFile.mkdirs();
  3402. }
  3403. }
  3404. return innerUploadFile;
  3405. }
  3406. });
  3407. } else {
  3408. uploadFile = new File(location);
  3409. if (!uploadFile.isAbsolute()) {
  3410. //if it is not an absolute path, make it relative to the tmp dir
  3411. uploadFile = new File(tmpLocation, location);
  3412. if (!uploadFile.exists()) {
  3413. //create it
  3414. uploadFile.mkdirs();
  3415. }
  3416. }
  3417. }
  3418. }
  3419. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3420. logger.logp(Level.FINE, CLASS_NAME,"parseMultipart", "uploadFile location --> " + uploadFile.getAbsolutePath());
  3421. }
  3422. multiPartServletConfig.setMultipartBaseLocation(uploadFile);
  3423. }
  3424. DiskFileItemFactory fact = new DiskFileItemFactory(fileThreshold, uploadFile);
  3425. ServletFileUpload sfu = new ServletFileUpload(fact);
  3426. sfu.setFileSizeMax(maxFileSize);
  3427. if(WCCustomProperties.USE_MAXREQUESTSIZE_FOR_MULTIPART){//PI75528
  3428. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3429. logger.logp(Level.FINE, CLASS_NAME,"parseMultipart", "usemaxrequestsizeformultipart property set");
  3430. }
  3431. sfu.setSizeMax(maxRequestSize);
  3432. }
  3433. List list=null;
  3434. try {
  3435. if (_srtRequestHelper.multipartException!=null) {
  3436. //this means that we previously hit an exception when parsing. An exception might not have been propogated to the client if this code was called for getParameter/getParameters
  3437. if (_srtRequestHelper.multipartISEException) {
  3438. throw (IllegalStateException) _srtRequestHelper.multipartException;
  3439. } else {
  3440. throw (IOException) _srtRequestHelper.multipartException;
  3441. }
  3442. }
  3443. if (System.getSecurityManager() != null) {
  3444. final ServletFileUpload finalSFU = sfu;
  3445. final SRTServletRequest finalThis = this;
  3446. try {
  3447. list = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<List>() {
  3448. public List run() throws FileUploadException {
  3449. List innerList = finalSFU.parseRequest(finalThis);
  3450. return innerList;
  3451. }
  3452. });
  3453. } catch (PrivilegedActionException e) {
  3454. //should be either a FileSizeLimitExceededException, SizeLimitExceededException, or FileUploadException
  3455. throw e.getException();
  3456. }
  3457. } else {
  3458. list = sfu.parseRequest(this);
  3459. }
  3460. if (list!= null) {
  3461. //724365.2 Start
  3462. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3463. logger.logp(Level.FINE, CLASS_NAME,"parseMultipart", "size after parsing request --> " + list.size());
  3464. }
  3465. int totalPartSize = 0;
  3466. int dupSize = 0; // 728397
  3467. HashSet<Integer> key_hset = new HashSet<Integer>(); // 728397
  3468. ArrayList<Part> partValues = null; //91002 Liberty
  3469. for (Object fileItem:list) {
  3470. Part p = morphIntoPart((DiskFileItem)fileItem);
  3471. boolean multipartPartsMapcontainsKey = _srtRequestHelper.multipartPartsHashMap.containsKey(p.getName()); //91002 Liberty
  3472. // 728397 Start
  3473. if( !multipartPartsMapcontainsKey){
  3474. if(!(key_hset.add(p.getName().hashCode()))){
  3475. dupSize++;// if false then count as duplicate hashcodes for unique keys
  3476. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3477. logger.logp(Level.FINE, CLASS_NAME,"parseMultipart", "duplicate hashCode generated by part --> " + p.getName());
  3478. }
  3479. if( dupSize > WCCustomProperties.MAX_DUPLICATE_HASHKEY_PARAMS){
  3480. throw new IllegalArgumentException(MessageFormat.format(nls.getString("Exceeding.maximum.hash.collisions"), new Object[]{WCCustomProperties.MAX_DUPLICATE_HASHKEY_PARAMS}));
  3481. }
  3482. }
  3483. }
  3484. // 728397 End
  3485. int maxParamPerRequest = WCCustomProperties.MAX_PARAM_PER_REQUEST;
  3486. if((maxParamPerRequest == -1) || (totalPartSize < maxParamPerRequest)){
  3487. //91002 Liberty Start
  3488. if(multipartPartsMapcontainsKey){
  3489. partValues =_srtRequestHelper.multipartPartsHashMap.get(p.getName());
  3490. partValues.add(p);
  3491. }
  3492. else{
  3493. partValues = new ArrayList<Part>();
  3494. partValues.add(0,p);
  3495. }
  3496. _srtRequestHelper.multipartPartsHashMap.put(p.getName(), partValues);
  3497. // _srtRequestHelper.multipartPartsHashMap.put(p.getName(), p); //91002 Liberty End
  3498. totalPartSize ++;
  3499. }
  3500. else{
  3501. throw new IllegalArgumentException(MessageFormat.format(nls.getString("Exceeding.maximum.parameters"), new Object[]{maxParamPerRequest, totalPartSize})); //724365.4
  3502. }// 724365.2 End
  3503. }
  3504. }
  3505. }
  3506. catch(FileSizeLimitExceededException fileSizeException) {
  3507. _srtRequestHelper.multipartException = new IllegalStateException(nls.getString("multipart.file.size.too.big"));
  3508. _srtRequestHelper.multipartISEException = true;
  3509. throw (IllegalStateException)_srtRequestHelper.multipartException;
  3510. }
  3511. catch (SizeLimitExceededException sizeException) {
  3512. _srtRequestHelper.multipartException = new IllegalStateException(nls.getString("multipart.request.size.too.big"));
  3513. _srtRequestHelper.multipartISEException = true;
  3514. throw (IllegalStateException)_srtRequestHelper.multipartException;
  3515. }
  3516. catch (FileUploadException e) {
  3517. _srtRequestHelper.multipartException = new IOException(nls.getString("multipart.file.upload.exception"), e);
  3518. throw (IOException)_srtRequestHelper.multipartException;
  3519. } catch (RuntimeException e) {
  3520. throw (RuntimeException) e;
  3521. } catch (Exception e) {
  3522. throw new IOException("", e);
  3523. }
  3524. }
  3525. // replaced for Servlet 3.1
  3526. protected Part morphIntoPart(DiskFileItem commonsFile) {
  3527. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3528. checkRequestObjectInUse();
  3529. }
  3530. Part p = new SRTServletRequestPart(commonsFile);
  3531. return p;
  3532. }
  3533. @Override
  3534. public void login(String username, String password) throws ServletException {
  3535. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3536. checkRequestObjectInUse();
  3537. }
  3538. WebApp webApp = this.getDispatchContext().getWebApp();
  3539. try {
  3540. webApp.getCollaboratorHelper().getSecurityCollaborator().login(this,(HttpServletResponse)this.getResponse(),username,password);
  3541. // as per TCK tests this code needs to throw back ServletException for login problems
  3542. } catch (ServletException e) {
  3543. throw e;
  3544. } catch (Exception e) {
  3545. ServletException se = new ServletException(e);
  3546. throw se;
  3547. }
  3548. }
  3549. @Override
  3550. public void logout() throws ServletException {
  3551. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3552. checkRequestObjectInUse();
  3553. }
  3554. WebApp webApp = this.getDispatchContext().getWebApp();
  3555. webApp.getCollaboratorHelper().getSecurityCollaborator().logout(this,(HttpServletResponse)this.getResponse());
  3556. }
  3557. @Override
  3558. public void setAsyncStarted(boolean b) {
  3559. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3560. checkRequestObjectInUse();
  3561. }
  3562. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3563. logger.logp(Level.FINE, CLASS_NAME,"setAsyncStarted", "value = " + b + ", this->"+this);
  3564. }
  3565. this._srtRequestHelper.asyncStarted = b;
  3566. }
  3567. // PM92496 Start
  3568. /**
  3569. * @param httpServletReq
  3570. * @param cs
  3571. */
  3572. public void setSSLAttributesInRequest(HttpServletRequest httpServletReq, String cs){
  3573. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3574. checkRequestObjectInUse();
  3575. }
  3576. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3577. logger.logp(Level.FINE, CLASS_NAME,"setSSLAttributesInRequest", "this->"+this+": " +" ,httpServletReq->"+ httpServletReq);
  3578. }
  3579. String cipherSuite = null;
  3580. cipherSuite = cs;
  3581. if (cipherSuite != null) {
  3582. httpServletReq.setAttribute("javax.servlet.request.cipher_suite", cipherSuite);
  3583. //Start 721610 (PM51389)
  3584. Integer keySize = null;
  3585. if (keySizeFromCipherMap) {
  3586. // check for the values in Map which
  3587. // has cipher to bit size map
  3588. keySize = com.ibm.ws.webcontainer.WebContainer.getWebContainer().getKeySizefromCipherMap(cipherSuite);
  3589. if (keySize == null) {
  3590. if (cipherSuite.contains("_AES_256_")) {
  3591. keySize = 256;
  3592. } else if (cipherSuite.contains("_3DES_")) {
  3593. keySize = 168;
  3594. } else if (cipherSuite.contains("_AES_128_")
  3595. || cipherSuite.contains("_RC4_128_")) {
  3596. keySize = 128;
  3597. } else if (cipherSuite.contains("_DES_")) {
  3598. keySize = 56;
  3599. } else if (cipherSuite.contains("_RC4_40_")
  3600. || cipherSuite.contains("_DES40_")) {
  3601. keySize = 40;
  3602. } else if (cipherSuite.contains("_NULL_")) {
  3603. keySize = 0;
  3604. }
  3605. }
  3606. } else {
  3607. // Now check the sslbitsize.properties file which can be modified by customer.
  3608. // see if there's a bit size
  3609. if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
  3610. logger.logp(Level.FINE, CLASS_NAME,"setSSLAttributesInRequest"," check for the size in properties file");
  3611. keySize = WebContainer.getWebContainer().getKeySize(cipherSuite);
  3612. }
  3613. if (keySize != null){
  3614. httpServletReq.setAttribute("javax.servlet.request.key_size", keySize);
  3615. }
  3616. //End 721610 (PM51389)
  3617. }
  3618. else{
  3619. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3620. logger.logp(Level.FINE, CLASS_NAME,"setSSLAttributesInRequest", "no SSL Attributes to set");
  3621. }
  3622. }
  3623. }
  3624. // PM92496(PM83905) End
  3625. protected WebAppDispatcherContext getDispatchContext() {
  3626. WebAppDispatcherContext dc=(WebAppDispatcherContext)SRTServletRequestThreadData.getInstance().getDispatchContext();
  3627. if (dc==null)
  3628. dc = _dispatchContext;
  3629. return dc;
  3630. }
  3631. @Override
  3632. public Throwable getCurrentException() {
  3633. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3634. logger.logp(Level.FINE, CLASS_NAME,"getCurrentException", "_dispatchContext : " + getDispatchContext());
  3635. }
  3636. if (getDispatchContext()== null) {
  3637. return null;
  3638. }
  3639. return getDispatchContext().getCurrentException();
  3640. }
  3641. /**
  3642. * Serialize the Map object of InputStreamData.
  3643. * The format is as follows:
  3644. * byte[0][] : byte array of long value of INPUT_STREAM_CONTENT_DATA_LENGTH
  3645. * byte[1][] : the length of INPUT_STREAM_CONTENT_TYPE
  3646. * byte[2][] : the byte array of the value of INPUT_STREAM_CONTENT_TYPE if the length is zero, it only contains one byte data of which value is zero.
  3647. * byte[3...] : byte array of INPUT_STREAM_CONTENT_DATA (it could be multiple tWAS v9) byte[3] doesn't exist if the length is zero.
  3648. */
  3649. @SuppressWarnings("rawtypes")
  3650. @Override
  3651. public byte[][] serializeInputStreamData(Map isd) throws IOException, UnsupportedEncodingException, IllegalStateException {
  3652. validateInputStreamData(isd);
  3653. String type = (String)isd.get(INPUT_STREAM_CONTENT_TYPE);
  3654. Integer length = (Integer)isd.get(INPUT_STREAM_CONTENT_DATA_LENGTH);
  3655. byte[] data = (byte [])isd.get(INPUT_STREAM_CONTENT_DATA);
  3656. int arraySize = OFFSET_CONTENT_DATA;
  3657. if (data != null) {
  3658. arraySize ++;
  3659. }
  3660. byte[][] output = new byte[arraySize][];
  3661. output[OFFSET_CONTENT_DATA_LENGTH] = longToBytes((long)length.intValue());
  3662. if (type != null) {
  3663. output[OFFSET_CONTENT_TYPE_LEN] = intToBytes(type.length());
  3664. output[OFFSET_CONTENT_TYPE_DATA] = type.getBytes("UTF-8");
  3665. } else {
  3666. output[OFFSET_CONTENT_TYPE_LEN] = intToBytes(0);
  3667. output[OFFSET_CONTENT_TYPE_DATA] = new byte[1];
  3668. }
  3669. if (data != null) {
  3670. output[OFFSET_CONTENT_DATA] = data;
  3671. }
  3672. if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3673. String message = "total : " + sizeInputStreamData(isd) + " number of items : " + output.length;
  3674. logger.logp(Level.FINE, CLASS_NAME,"serializeInputStreamData", message);
  3675. }
  3676. return output;
  3677. }
  3678. @SuppressWarnings("rawtypes")
  3679. @Override
  3680. public HashMap deserializeInputStreamData(byte[][] input) throws UnsupportedEncodingException, IllegalStateException {
  3681. if (input == null || input.length < 2) {
  3682. if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  3683. logger.logp(Level.FINE, CLASS_NAME,"deseriallizeInputStreamData", "The input data is null or fewer items than the expected. ");
  3684. throw new IllegalStateException("Invalid data.");
  3685. }
  3686. HashMap output = new HashMap();
  3687. long length = bytesToLong(input[OFFSET_CONTENT_DATA_LENGTH]);
  3688. output.put(INPUT_STREAM_CONTENT_DATA_LENGTH, Integer.valueOf((int)(length & 0xFFFF)));
  3689. int typeLen = bytesToInt(input[OFFSET_CONTENT_TYPE_LEN]);
  3690. if (typeLen > 0) {
  3691. output.put(INPUT_STREAM_CONTENT_TYPE, new String(input[OFFSET_CONTENT_TYPE_DATA], "UTF-8"));
  3692. } else {
  3693. output.put(INPUT_STREAM_CONTENT_TYPE, null);
  3694. }
  3695. int items = input.length;
  3696. if (length > 0 && items > OFFSET_CONTENT_DATA) {
  3697. output.put(INPUT_STREAM_CONTENT_DATA, input[OFFSET_CONTENT_DATA]);
  3698. } else {
  3699. output.put(INPUT_STREAM_CONTENT_DATA, null);
  3700. }
  3701. return output;
  3702. }
  3703. /**
  3704. * returns estimated size of serialized InputStreamData
  3705. * this code does not consider that the length in long overwraps.
  3706. */
  3707. @SuppressWarnings("rawtypes")
  3708. @Override
  3709. public long sizeInputStreamData(Map isd) throws UnsupportedEncodingException, IllegalStateException {
  3710. validateInputStreamData(isd);
  3711. // The length of IMPUT_STREAM_CONTENT_TYPE won't exceed Integer.MAX_VALUE
  3712. long size = LENGTH_INT + LENGTH_LONG;
  3713. String type = (String)isd.get(INPUT_STREAM_CONTENT_TYPE);
  3714. if (type != null) {
  3715. size += type.getBytes("UTF-8").length;
  3716. } else {
  3717. size +=1; // if the size is zero, one byte data will be used for placeholder.
  3718. }
  3719. byte [] data = (byte [])isd.get(INPUT_STREAM_CONTENT_DATA);
  3720. if (data != null) {
  3721. size += data.length;
  3722. }
  3723. if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  3724. logger.logp(Level.FINE, CLASS_NAME,"sizeInputStreamData", Long.toString(size));
  3725. return size;
  3726. }
  3727. /**
  3728. * verify the InputStreamData Map object contains required value.
  3729. * throws IllegalStateException if there is any missing values.
  3730. */
  3731. @SuppressWarnings("rawtypes")
  3732. protected void validateInputStreamData(Map isd) throws IllegalStateException {
  3733. String message = null;
  3734. if (isd != null) {
  3735. if (isd.size() <= 3) {
  3736. boolean type = isd.containsKey(INPUT_STREAM_CONTENT_TYPE);
  3737. boolean length = isd.containsKey(INPUT_STREAM_CONTENT_DATA_LENGTH);
  3738. boolean data = isd.containsKey(INPUT_STREAM_CONTENT_DATA);
  3739. if (type && length && data) {
  3740. // valid.
  3741. return;
  3742. } else {
  3743. message = "One of required values of InputStreamData is missing. type : " + type + " length : " + length + " data : " + data;
  3744. }
  3745. } else {
  3746. message = "InputStreamData contains an unrecognized item.";
  3747. }
  3748. } else {
  3749. message = "InputStreamData is null.";
  3750. }
  3751. if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
  3752. logger.logp(Level.FINE, CLASS_NAME,"validateInputStreamData", message);
  3753. throw new IllegalStateException(message);
  3754. }
  3755. protected byte[] intToBytes(int i) {
  3756. byte[] result = new byte[4];
  3757. result[0] = (byte) (i >> 24);
  3758. result[1] = (byte) (i >> 16);
  3759. result[2] = (byte) (i >> 8);
  3760. result[3] = (byte) (i);
  3761. return result;
  3762. }
  3763. protected int bytesToInt(byte[] b) {
  3764. int value = 0;
  3765. for (int i = 0; i < 4; i++) {
  3766. value <<= 8;
  3767. value += (b[i] & 0xFF);
  3768. }
  3769. return value;
  3770. }
  3771. protected byte[] longToBytes(long l) {
  3772. byte[] value = new byte[8];
  3773. for (int i = 7; i >= 0; i--) {
  3774. value[i] = (byte)(l & 0xFF);
  3775. l >>= 8;
  3776. }
  3777. return value;
  3778. }
  3779. protected long bytesToLong(byte[] b) {
  3780. long value = 0;
  3781. for (int i = 0; i < 8; i++) {
  3782. value <<= 8;
  3783. value += (b[i] & 0xFF);
  3784. }
  3785. return value;
  3786. }
  3787. //MultiRead Start
  3788. /* (non-Javadoc)
  3789. * @see com.ibm.ws.http.channel.inputstream.HttpInputStreamObserver#alertISOpen()
  3790. */
  3791. @Override
  3792. public void alertISOpen() {
  3793. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3794. logger.logp(Level.FINE, CLASS_NAME,"alertISOpen()", "");
  3795. }
  3796. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3797. checkRequestObjectInUse();
  3798. }
  3799. _srtRequestHelper._InputStreamClosed=false;
  3800. this.releaseInputStream();
  3801. this.releaseReader();
  3802. }
  3803. /* (non-Javadoc)
  3804. * @see com.ibm.ws.http.channel.inputstream.HttpInputStreamObserver#alertISClose()
  3805. */
  3806. @Override
  3807. public void alertISClose() {
  3808. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3809. logger.logp(Level.FINE, CLASS_NAME,"alertISClose()", "");
  3810. }
  3811. if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
  3812. checkRequestObjectInUse();
  3813. }
  3814. if (_srtRequestHelper != null)
  3815. _srtRequestHelper._InputStreamClosed=true;
  3816. }
  3817. /* (non-Javadoc)
  3818. * @see com.ibm.wsspi.webcontainer.servlet.IExtendedRequest#setValuesIfMultiReadofPostdataEnabled()
  3819. */
  3820. @Override
  3821. public void setValuesIfMultiReadofPostdataEnabled() {
  3822. if(!httpUpdatedwMultiReadValues) {
  3823. WebApp webapp = getDispatchContext().getWebApp();
  3824. if (webapp != null){
  3825. multiReadPropertyEnabled = webapp.getConfiguration().isEnablemultireadofpostdata();
  3826. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3827. logger.logp(Level.FINE, CLASS_NAME,"setValuesIfMultiReadofPostdataEnabled", "this._in->"+this._in+": multiReadPropertyEnabled is " + multiReadPropertyEnabled);
  3828. }
  3829. if(multiReadPropertyEnabled){
  3830. if(this._in instanceof SRTInputStream) {
  3831. ((SRTInputStream)this._in).setupforMultiRead(true);
  3832. ((SRTInputStream) this._in).setISObserver(this);
  3833. }
  3834. }
  3835. httpUpdatedwMultiReadValues = true;
  3836. }
  3837. else{
  3838. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3839. logger.logp(Level.FINE, CLASS_NAME,"setValuesIfMultiReadofPostdataEnabled", "this->"+this+": webapp is " + webapp);
  3840. }
  3841. }
  3842. }
  3843. else{
  3844. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
  3845. logger.logp(Level.FINE, CLASS_NAME,"setValuesIfMultiReadofPostdataEnabled", "this->"+this+": channelUpdated -> " +httpUpdatedwMultiReadValues);
  3846. }
  3847. }
  3848. }
  3849. protected String getSrtHelperCharEncoding() {
  3850. return _srtRequestHelper._characterEncoding;
  3851. }
  3852. }