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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.4, 3.1.1
    • Fix Version/s: 3.0.6, 3.1.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      all

    • Estimated Complexity:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: