Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E24B6173B0 for ; Wed, 24 Jun 2015 10:53:04 +0000 (UTC) Received: (qmail 65118 invoked by uid 500); 24 Jun 2015 10:53:04 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 65080 invoked by uid 500); 24 Jun 2015 10:53:04 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 65069 invoked by uid 99); 24 Jun 2015 10:53:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2015 10:53:04 +0000 Date: Wed, 24 Jun 2015 10:53:04 +0000 (UTC) From: "tomek778 (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CXF-6472) Cannot create ContextResolver for class extending HttpServletRequest, HttpServletResponse, etc. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-6472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14599236#comment-14599236 ] tomek778 edited comment on CXF-6472 at 6/24/15 10:52 AM: --------------------------------------------------------- CustomHttpRequest is not a standard JAX-RS context object. Let's say it accidentally implements HttpServletRequest interface. If I am asking for @Context CustomHttpRequest context object but cxf would like to give me the equivalent of @Context HttpServletRequest and it fails with ClassCastException. This is a bug for me. was (Author: user778): CustomHttpRequest is not a standard JAX-RS context object. Let's say it accidentally implements HttpServletRequest interface. If I am asking for @Context CustomHttpRequest context object but I receive equivalent of @Context HttpServletRequest. This is a bug for me. > 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 { > @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)