public static void moveHeader ( HttpResponse response , String srcName , String targetName ) { if ( response . containsHeader ( srcName ) ) { LOG . info ( "Moving header {} to {}" , srcName , targetName ) ; Header [ ] headers = response . getHeaders ( srcName ) ; response . removeHeaders ( targetName ) ; for ( Header h : headers ) { response . addHeader ( targetName , h . getValue ( ) ) ; } response . removeHeaders ( srcName ) ; } }
This method can be used directly to move an header .