You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2015/06/30 12:22:05 UTC

[jira] [Resolved] (CXF-6472) Cannot create ContextResolver for class extending HttpServletRequest, HttpServletResponse, etc.

     [ https://issues.apache.org/jira/browse/CXF-6472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-6472.
-----------------------------------
       Resolution: Fixed
         Assignee: Sergey Beryozkin
    Fix Version/s: 3.1.2
                   3.0.6

> Cannot create ContextResolver for class extending HttpServletRequest, HttpServletResponse, etc.
> -----------------------------------------------------------------------------------------------
>
>                 Key: CXF-6472
>                 URL: https://issues.apache.org/jira/browse/CXF-6472
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.0.4, 3.1.1
>         Environment: all
>            Reporter: tomek778
>            Assignee: Sergey Beryozkin
>             Fix For: 3.0.6, 3.1.2
>
>
> 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. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)