class ServletContainerResponseWriter implements ContainerResponseWriter {

    @Override
    public void writeHeaders(GenericContainerResponse response) throws IOException {
        if (servletResponse.isCommitted()) {
            return;
        }

        servletResponse.setStatus(response.getStatus());

        if (response.getHttpHeaders() != null) {
            // content-type and content-length should be preset in headers
            for (Map.Entry<String, List<Object>> e : response.getHttpHeaders().entrySet()) {
                String name = e.getKey();
                for (Object o : e.getValue()) {
                    String value;
                    if (o != null && (value = HeaderHelper.getHeaderAsString(o)) != null) {
                        servletResponse.addHeader(name, value);
                    }
                }
            }
        }
    }

    public  ServletContainerResponseWriter(HttpServletResponse response);

}