class ResponseImpl extends Response {

    @Override
    public Map<String, NewCookie> getCookies() {
        List<Object> cookieHeaders = getMetadata().get(SET_COOKIE);
        if (cookieHeaders == null) {
            return Collections.emptyMap();
        }
        Map<String, NewCookie> cookies = new HashMap<>();
        for (Object cookieHeader : cookieHeaders) {
            if (cookieHeader instanceof NewCookie) {
                NewCookie newCookie = (NewCookie)cookieHeader;
                cookies.put(newCookie.getName(), newCookie);
            } else if (cookieHeader != null) {
                NewCookie newCookie = NewCookie.valueOf(getHeaderAsString(cookieHeader));
                if (newCookie != null) {
                    cookies.put(newCookie.getName(), newCookie);
                }
            }
        }

        return cookies;
    }

    protected  ResponseImpl(int status, Object entity, Annotation[] entityAnnotations, MultivaluedMap<String, Object> headers);

}