Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6472

Cannot create ContextResolver for class extending HttpServletRequest, HttpServletResponse, etc.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.4, 3.1.1
    • 3.0.6, 3.1.2
    • None
    • None
    • all

    • Unknown

    Description

      I tried to wrap HttpServletRequest by using ContextProvider, lets assume such a simple implementation:

      @Provider
      public class CustomHttpRequestContextResolver implements ContextResolver<CustomHttpRequest> {

      @Context
      private HttpServletRequest request;

      public CustomHttpRequest getContext(Class<?> type)

      { return new CustomHttpRequest(request); }

      }

      However, before calling context provider CXF first calls JAXRSUtils.createServletResourceValue() method that tries to cast HttpServletRequest into my wrapped request and it fails with ClassCastException.

      I havent found in JAX_RS spec anything telling that such a ContextResolver is forbidden.This works also with Apache Wink.

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            user778 tomek778
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: