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 63F4519847 for ; Tue, 15 Mar 2016 16:53:34 +0000 (UTC) Received: (qmail 82445 invoked by uid 500); 15 Mar 2016 16:53:34 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 82323 invoked by uid 500); 15 Mar 2016 16:53:34 -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 81995 invoked by uid 99); 15 Mar 2016 16:53:34 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Mar 2016 16:53:34 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id C90592C1F6C for ; Tue, 15 Mar 2016 16:53:33 +0000 (UTC) Date: Tue, 15 Mar 2016 16:53:33 +0000 (UTC) From: "Jan Cetkovsky (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CXF-5702) CXF 3.0 ApplicationPath issue with JAX-RS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-5702?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D151956= 28#comment-15195628 ]=20 Jan Cetkovsky commented on CXF-5702: ------------------------------------ [~sergeyb] Thank you for your help! I reported this to Romain yesterday alr= eady and he fixed it under https://issues.apache.org/jira/browse/TOMEE-1731 > CXF 3.0 ApplicationPath issue with JAX-RS > ----------------------------------------- > > Key: CXF-5702 > URL: https://issues.apache.org/jira/browse/CXF-5702 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 3.0.0-milestone2 > Environment: Windows > Reporter: Kou, Zhi Qiang > Assignee: Sergey Beryozkin > Priority: Minor > Fix For: 3.0.0 > > > It seems CXF JAX-RS implementation has something wrong with the relations= hip between defined servlet-mapping and the value of ApplicationPath annota= tion. > From JSR-339 spec, section 2.3.2: If the Application subclass is annotate= d with @ApplicationPath, implementations are REQUIRED to use the value of t= his annotation appended with =E2=80=9D/*=E2=80=9D to define a mapping for t= he added server. Otherwise, the application MUST be packaged with a web.xml= that specifies a servlet mapping. > Also from ApplicationPath javadoc: > Identifies the application path that serves as the base URI for all resou= rce URIs provided by Path. May only be applied to a subclass of Application= . *When published in a Servlet container, the value of the application path= may be overridden using a servlet-mapping element in the web.xml.* > https://jsr311.java.net/nonav/javadoc/javax/ws/rs/ApplicationPath.html > From above information, if both servlet-mapping in web.xml and Applicatio= nPath has value, only one of them should be used as the base URI, and it sh= ould be the value of servlet-mapping in web.xml. > In my application, my web.xml looks like below. There are two servlet def= ined, each for one jaxrs application. And the servlet-mapping values are de= fined as "/first/" and "/second/". > {quote} > =09 > =09=09rest1 > =09=09org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServle= t > =09=09 > =09=09=09javax.ws.rs.Application > =09=09=09com.ibm.sample.jaxrs.UserDemoApplication > =09=09 > =09 > =09 > =09=09rest2 > =09=09org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServle= t > =09=09 > =09=09=09javax.ws.rs.Application > =09=09=09com.ibm.sample.jaxrs.GroupDemoApplication > =09=09 > =09 > =09 > =09=09rest1 > =09=09/first/* > =09 > =09 > =09=09rest2 > =09=09/second/* > =09 > {quote} > And in my application classes: > {quote} > @ApplicationPath("userdemo") > public class UserDemoApplication extends javax.ws.rs.core.Application { > @ApplicationPath("groupdemo") > public class GroupDemoApplication extends javax.ws.rs.core.Application { > {quote} > So in this case according to spec and javadoc, "/first/" and "/second/" s= hould be used as the base URI, but not the "userdemo" and "groupdemo" or BO= TH. > But in my CXF application I can only access the resources via URLs: > http://localhost:9080/SingleParameterCxf/first/userdemo/users/eric > http://localhost:9080/SingleParameterCxf/second/groupdemo/groups/root > However if I implement the same application using Jersey RI libs, I can a= ccess my resources via URLs: > http://localhost:9080/SingleParameterJersey/first/users/eric > http://localhost:9080/SingleParameterJersey/second/groups/root > My feeling is Jersey RI implementation is correct behavior according to S= PEC and JavaDoc. Please let me know if my understanding is correct or not. > Any help is highly appreciated! Thank you! -- This message was sent by Atlassian JIRA (v6.3.4#6332)