public static Pair < String , String > [ ] cloneHeaders ( HttpServletRequest req ) { List < Pair < String , String > > headers = new ArrayList < Pair < String , String > > ( ) ; Enumeration < String > e = req . getHeaderNames ( ) , ee ; String name ; while ( e . hasMoreElements ( ) ) { name = e . nextElement ( ) ; ee = req . getHeaders ( name ) ; while ( ee . hasMoreElements ( ) ) { headers . add ( new Pair < String , String > ( name , ee . nextElement ( ) . toString ( ) ) ) ; } } return ( Pair < String , String > [ ] ) headers . toArray ( new Pair [ headers . size ( ) ] ) ; }
read all headers from request and return it