protected void doFilterImpl ( ServletRequest pRequest , ServletResponse pResponse , FilterChain pChain ) throws IOException , ServletException { // TODO: Max size configuration, to avoid DOS attacks? OutOfMemory // Size parameters int width = ServletUtil . getIntParameter ( pRequest , sizeWidthParam , - 1 ) ; int height = ServletUtil . getIntParameter ( pRequest , sizeHeightParam , - 1 ) ; if ( width > 0 || height > 0 ) { pRequest . setAttribute ( ImageServletResponse . ATTRIB_SIZE , new Dimension ( width , height ) ) ; } // Size uniform/percent boolean uniform = ServletUtil . getBooleanParameter ( pRequest , sizeUniformParam , true ) ; if ( ! uniform ) { pRequest . setAttribute ( ImageServletResponse . ATTRIB_SIZE_UNIFORM , Boolean . FALSE ) ; } boolean percent = ServletUtil . getBooleanParameter ( pRequest , sizePercentParam , false ) ; if ( percent ) { pRequest . setAttribute ( ImageServletResponse . ATTRIB_SIZE_PERCENT , Boolean . TRUE ) ; } // Area of interest parameters int x = ServletUtil . getIntParameter ( pRequest , regionLeftParam , - 1 ) ; // Default is center int y = ServletUtil . getIntParameter ( pRequest , regionTopParam , - 1 ) ; // Default is center width = ServletUtil . getIntParameter ( pRequest , regionWidthParam , - 1 ) ; height = ServletUtil . getIntParameter ( pRequest , regionHeightParam , - 1 ) ; if ( width > 0 || height > 0 ) { pRequest . setAttribute ( ImageServletResponse . ATTRIB_AOI , new Rectangle ( x , y , width , height ) ) ; } // AOI uniform/percent uniform = ServletUtil . getBooleanParameter ( pRequest , regionUniformParam , false ) ; if ( uniform ) { pRequest . setAttribute ( ImageServletResponse . ATTRIB_SIZE_UNIFORM , Boolean . TRUE ) ; } percent = ServletUtil . getBooleanParameter ( pRequest , regionPercentParam , false ) ; if ( percent ) { pRequest . setAttribute ( ImageServletResponse . ATTRIB_SIZE_PERCENT , Boolean . TRUE ) ; } super . doFilterImpl ( pRequest , pResponse , pChain ) ; }
Extracts request parameters and sets the corresponding request attributes if specified .