question: public static String encodeForRedirect ( final String str ) { String classMethod = "SAML2Utils.encodeForRedirect: " ; byte [ ] input ; try { input = str . getBytes ( "UTF-8" ) ; } catch ( UnsupportedEncodingException uee ) { debug . error ( classMethod + "cannot get byte array: " , uee ) ; return null ; } Deflater deflater = new Deflater ( Deflater . DEFAULT_COMPRESSION , true ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream ( out , deflater ) ; try { deflaterOutputStream . write ( input ) ; } catch ( IOException e ) { debug . error ( classMethod + "There was a problem compressing the input" , e ) ; return null ; } finally { IOUtils . closeIfNotNull ( deflaterOutputStream ) ; } String encoded = URLEncDec . encode ( Base64 . encode ( out . toByteArray ( ) ) ) ; if ( debug . messageEnabled ( ) ) { debug . message ( classMethod + "out string length : " + encoded . length ( ) ) ; debug . message ( classMethod + "out string is ===>" + encoded + "<===" ) ; } return encoded ; }
target:  Returns the encoded request message. The SAML Request message must be encoded before being transmitted. The Request message is encoded as follows: 1. URL Encoded using the DEFLATE compression method. 2. Then the message is base-64 encoded according to the rules specified in RFC2045.