cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CXF-6472) Cannot create ContextResolver for class extending HttpServletRequest, HttpServletResponse, etc.
Date Wed, 24 Jun 2015 12:09:04 GMT

    [ https://issues.apache.org/jira/browse/CXF-6472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14599309#comment-14599309
] 

Sergey Beryozkin edited comment on CXF-6472 at 6/24/15 12:08 PM:
-----------------------------------------------------------------

See
http://git-wip-us.apache.org/repos/asf/cxf/commit/d9761079

Re using ContextResolver - please ask at the jaxrs users list to confirm that using ContextResolver
is not a compliant mechanism to inject custom contexts.


was (Author: sergey_beryozkin):
See
http://git-wip-us.apache.org/repos/asf/cxf/commit/d9761079

Re using ContextResolver - please ask at the jaxrs users list to confirm that using ContextResolver
is not a compliant mechanism to inject custom providers.

> 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
>
> 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)

Mime
View raw message