public static void putHeaders(MimeHeaders headers,HttpServletResponse response){
  if (debug.messageEnabled()) {
    debug.message("SAML2Util.putHeaders: Header=" + headers.toString());
  }
  Iterator it=headers.getAllHeaders();
  while (it.hasNext()) {
    MimeHeader header=(MimeHeader)it.next();
    String[] values=headers.getHeader(header.getName());
    if (debug.messageEnabled()) {
      debug.message("SAML2Util.putHeaders: Header name=" + header.getName() + ", value="+ Arrays.toString(values));
    }
    if (values.length == 1) {
      response.setHeader(header.getName(),header.getValue());
    }
 else {
      StringBuilder concatenatedHeaderValues=new StringBuilder();
      for (int i=0; i < values.length; i++) {
        if (i != 0) {
          concatenatedHeaderValues.append(',');
        }
        concatenatedHeaderValues.append(values[i]);
      }
      response.setHeader(header.getName(),concatenatedHeaderValues.toString());
    }
  }
}

public static void putHeaders ( MimeHeaders headers , HttpServletResponse response ) { if ( debug . messageEnabled ( ) ) { debug . message ( "SAML2Util.putHeaders: Header=" + headers . toString ( ) ) ; } Iterator it = headers . getAllHeaders ( ) ; while ( it . hasNext ( ) ) { MimeHeader header = ( MimeHeader ) it . next ( ) ; String [ ] values = headers . getHeader ( header . getName ( ) ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "SAML2Util.putHeaders: Header name=" + header . getName ( ) + ", value=" + Arrays . toString ( values ) ) ; } if ( values . length == 1 ) { response . setHeader ( header . getName ( ) , header . getValue ( ) ) ; } else { StringBuilder concatenatedHeaderValues = new StringBuilder ( ) ; for ( int i = 0 ; i < values . length ; i ++ ) { if ( i != 0 ) { concatenatedHeaderValues . append ( ',' ) ; } concatenatedHeaderValues . append ( values [ i ] ) ; } response . setHeader ( header . getName ( ) , concatenatedHeaderValues . toString ( ) ) ; } } }
sets mime headers in http servlet response .
