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 F28EC10B0A for ; Thu, 3 Oct 2013 20:08:47 +0000 (UTC) Received: (qmail 44852 invoked by uid 500); 3 Oct 2013 20:08:47 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 44698 invoked by uid 500); 3 Oct 2013 20:08:47 -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 44404 invoked by uid 99); 3 Oct 2013 20:08:42 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Oct 2013 20:08:42 +0000 Date: Thu, 3 Oct 2013 20:08:42 +0000 (UTC) From: "Sergey Beryozkin (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CXF-5316) REST Overriding request URI doesn't change serviceBeans 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-5316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sergey Beryozkin resolved CXF-5316. ----------------------------------- Resolution: Not A Problem Assignee: Sergey Beryozkin > REST Overriding request URI doesn't change serviceBeans > ------------------------------------------------------- > > Key: CXF-5316 > URL: https://issues.apache.org/jira/browse/CXF-5316 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 2.7.6 > Reporter: DUCHEOL KIM > Assignee: Sergey Beryozkin > > Hi All. > I am writing RESTful API code using CXF. > For the versioning, we plan to implement based on Content-Type header. > For this, I'm trying to two ways but both of them aren't work. > 1. Use different Consumes annotation at same class. > I try to set different Content-Type at same class, but it always work with one method. > @POST > @Path("/") > @Produces("application/json") > @Consumes("application/json; application,v=2") > public Response createProjectV2(Person person) { > .... > } > ... > @POST > @Path("/") > @Produces("application/json") > @Consumes("application/json") > public Response createProject(Person person) { > .... > } > always "createProject" which has "application/json" on Consumes annotation. > 2. Update Request URI at interceptor to use different serviceBean for differnt version. > public class CommonInInterceptorImpl implements RequestHandler{ > public Response handleRequest(Message message , ClassResourceInfo resourceClass) { > ... > String requestUri = (String)message.get(Message.REQUEST_URI); > String basePath = (String)message.get(Message.BASE_PATH); > > String targetPath = basePath+"ver-"+version+"/"+requestUri.substring(basePath.length()); > message.put(Message.CONTENT_TYPE, "application/json;application,v=2"); > message.put(Message.REQUEST_URI, targetPath); > ... > } > .... > Service Bean 1 > @Path(PersonService.PERSON_SERVICE_URL) > public class PersonService extends RESTApiHandler{ > ... > } > Service Bean 2 ( in different package ) > @Path("/ver-2/"+com.tfsm.palette.api.rest.PersonService.PERSON_SERVICE_URL) > public class PersonService { > ... > } > I update REQUEST_URI at interceptor to redirect request to other serviceBean, but request is processed orginal desired serviceBean. > ( I expect redirect request to 2nd service Bean , but it always processed at 1st service Bean. ) > I don't know whether 1st approach is correct in JAX RS spec, but I expect 2nd have to be work because it is mentioned at your documentation. > http://cxf.apache.org/docs/jax-rs-filters.html#JAX-RSFilters-OverridingrequestURI%2Cqueryandheaders > Could you let me know how we could redirect request to different serviceBean ? -- This message was sent by Atlassian JIRA (v6.1#6144)