@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
    private static void applyHeader(final HttpServletResponse sresp,
        final String header) {
        final String[] parts = header.split(":");
        final String name = parts[0].trim();
        final String val = parts[1].trim();
        if ("set-cookie".equals(name.toLowerCase(Locale.getDefault()))) {
            for (final HttpCookie cck : HttpCookie.parse(header)) {
                sresp.addCookie(
                    new Cookie(cck.getName(), cck.getValue())
                );
            }
        } else {
            sresp.setHeader(name, val);
        }
    }
@ SuppressWarnings ( "PMD.AvoidInstantiatingObjectsInLoops" ) private static void applyHeader ( final HttpServletResponse sresp , final String header ) { final String [ ] parts = header . split ( ":" ) ; final String name = parts [ 0 ] . trim ( ) ; final String val = parts [ 1 ] . trim ( ) ; if ( "set-cookie" . equals ( name . toLowerCase ( Locale . getDefault ( ) ) ) ) { for ( final HttpCookie cck : HttpCookie . parse ( header ) ) { sresp . addCookie ( new Cookie ( cck . getName ( ) , cck . getValue ( ) ) ) ; } } else { sresp . setHeader ( name , val ) ; } }
Apply header to servlet response.
@param sresp Response
@param header Header