class CookieParameterResolver implements ParameterResolver<CookieParam> {

    @Override
    public Object resolve(org.everrest.core.Parameter parameter, ApplicationContext context) throws Exception {
        String param = cookieParam.value();
        if (Cookie.class.isAssignableFrom(parameter.getParameterClass())) {
            Cookie cookie = context.getHttpHeaders().getCookies().get(param);
            if (cookie == null && parameter.getDefaultValue() != null) {
                cookie = Cookie.valueOf(parameter.getDefaultValue());
            }
            return cookie;
        } else {
            TypeProducer typeProducer = typeProducerFactory.createTypeProducer(parameter.getParameterClass(), parameter.getGenericType());
            MultivaluedMap<String, String> cookieValues = new MultivaluedMapImpl();
            for (Map.Entry<String, Cookie> entry : context.getHttpHeaders().getCookies().entrySet()) {
                cookieValues.putSingle(entry.getKey(), entry.getValue().getValue());
            }
            return typeProducer.createValue(param, cookieValues, parameter.getDefaultValue());
        }
    }

      CookieParameterResolver(CookieParam cookieParam, TypeProducerFactory typeProducerFactory);

}