@ SuppressWarnings ( "rawtypes" ) public static Hashtable parsePostData ( ServletInputStream in , String encoding , boolean multireadPropertyEnabled ) /* 157338 add throws */ throws IOException { int inputLen ; byte [ ] postedBytes = null ; String postedBody ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "parsePostData" , "parsing chunked post data. encoding = " + encoding ) ; if ( in == null ) throw new IllegalArgumentException ( "post data inputstream is null" ) ; try { // // Make sure we read the entire POSTed body. // ByteArrayOutputStream byteOS = new ByteArrayOutputStream ( DEFAULT_BUFFER_SIZE ) ; do { byte [ ] readInBytes = new byte [ DEFAULT_BUFFER_SIZE ] ; inputLen = in . read ( readInBytes , 0 , DEFAULT_BUFFER_SIZE ) ; if ( inputLen > 0 ) { byteOS . write ( readInBytes , 0 , inputLen ) ; } } while ( inputLen != - 1 ) ; // MultiRead Start if ( multireadPropertyEnabled ) { in . close ( ) ; } // MultiRead End postedBytes = byteOS . toByteArray ( ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "parsePostData" , "finished reading [" + postedBytes . length + "] bytes" ) ; } catch ( IOException e ) { com . ibm . wsspi . webcontainer . util . FFDCWrapper . processException ( e , "com.ibm.ws.webcontainer.servlet.RequestUtils.parsePostData" , "598" ) ; // begin 157338 throw e ; //return new Hashtable(); // begin 157338 } // XXX we shouldn't assume that the only kind of POST body // is FORM data encoded using ASCII or ISO Latin/1 ... or // that the body should always be treated as FORM data. // try { postedBody = new String ( postedBytes , encoding ) ; } catch ( UnsupportedEncodingException e ) { com . ibm . wsspi . webcontainer . util . FFDCWrapper . processException ( e , "com.ibm.ws.webcontainer.servlet.RequestUtils.parsePostData" , "618" ) ; postedBody = new String ( postedBytes ) ; } if ( WCCustomProperties . PARSE_UTF8_POST_DATA && encoding . equalsIgnoreCase ( "UTF-8" ) ) { for ( byte nextByte : postedBytes ) { if ( nextByte < ( byte ) 0 ) { encoding = "8859_1" ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) logger . logp ( Level . FINE , CLASS_NAME , "parsePostData" , "UTF8 post data, set encoing to 8859_1 to prevent futrther encoding" ) ; break ; } } } return parseQueryString ( postedBody , encoding ) ; }
begin 231634 Support posts with query parms in chunked body WAS . webcontainer