cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "george.goodrich (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-2718) JAX-RS OSGi doesn't support relative path from annotation
Date Fri, 19 Mar 2010 00:32:27 GMT

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

george.goodrich commented on CXF-2718:
--------------------------------------

FYI

I installed the cxf-jaxrs example by installing the feature from web console, it works.
Then I osgi:stop the bundle, and osgi:start the bundle, the symptom came back.

If I osgi:install the example bundle, and osgi:start it, it didn't work.

I rebuilt the example in my eclipse, and it has the same issue. 

Below are the context and POM xml for the bundle.

Thanks a lot for the help.


<?xml version="1.0" encoding="UTF-8"?>
<!--
	Licensed to the Apache Software Foundation (ASF) under one
	or more contributor license agreements. See the NOTICE file
	distributed with this work for additional information
	regarding copyright ownership. The ASF licenses this file
	to you under the Apache License, Version 2.0 (the
	"License"); you may not use this file except in compliance
	with the License. You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing,
	software distributed under the License is distributed on an
	"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
	KIND, either express or implied. See the License for the
	specific language governing permissions and limitations
	under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxrs="http://cxf.apache.org/jaxrs"
        xmlns:osgi="http://www.springframework.org/schema/osgi"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

  <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
    <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />

    <jaxrs:server id="myService" address="/svc">
        <jaxrs:serviceBeans>
            <ref bean="svcBean"/>
        </jaxrs:serviceBeans>
    </jaxrs:server>


    <bean id="svcBean" class="com.test.SvcBeanImpl"/>

</beans>

POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

	<parent>
		<artifactId>features</artifactId>
		<groupId>org.apache.servicemix.features</groupId>
		<version>4.0.0</version>
	</parent>
	<modelVersion>4.0.0</modelVersion>
  <groupId>com.test</groupId>
  <artifactId>svc</artifactId>
  <packaging>bundle</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>svcbundle</name>
  <url>http://maven.apache.org</url>

  <properties>
	<servicemix.specs.version>1.4.0</servicemix.specs.version>
  	<jaxb.api.version>2.1</jaxb.api.version>
      <commons-httpclient.version>3.1_4</commons-httpclient.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

        <dependency>
            <groupId>org.apache.servicemix.specs</groupId>
            <artifactId>org.apache.servicemix.specs.jsr311-api-1.0</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.specs</groupId>
            <artifactId>org.apache.servicemix.specs.jaxb-api-${jaxb.api.version}</artifactId>
            <version>${servicemix.specs.version}</version>
        </dependency>

       <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.commons-httpclient</artifactId>
            <version>${commons-httpclient.version}</version>
        </dependency>

  </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                        <Import-Package>
                                javax.wsdl,
                                javax.xml.bind,
                                javax.xml.bind.annotation,
                                javax.ws.rs,
                                META-INF.cxf,
                                META-INF.cxf.osgi,
                                org.apache.cxf.bus,
                                org.apache.cxf.bus.spring,
                                org.apache.cxf.bus.resource,
                                org.apache.cxf.resource,
                                org.apache.cxf.configuration.spring,
                                org.apache.cxf.binding,
                                org.apache.cxf.jaxrs.utils,
                                org.apache.cxf.transport.http_osgi,
                                org.springframework.beans.factory.config,
                                com.test.SvcBeanImpl,
                                org.apache.commons.httpclient, 
                                org.apache.commons.httpclient.methods
                        </Import-Package>
                        <Require-Bundle>org.apache.cxf.bundle</Require-Bundle>
                        <Export-Package>com.test
                        </Export-Package>
                        <DynamicImport-Package>javax.ws.rs.*</DynamicImport-Package>
                     </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


> JAX-RS OSGi doesn't support relative path from annotation
> ---------------------------------------------------------
>
>                 Key: CXF-2718
>                 URL: https://issues.apache.org/jira/browse/CXF-2718
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.6
>         Environment: Ubuntu 9 
> servicemix-4.2.0-fuse-01-00
>            Reporter: george.goodrich
>         Attachments: configuration-status-20100318-1258-0700.txt
>
>
> I tried to use CXF JAX-RS in ServiceMix 4.2/Fuse ESB.
> Somehow I had to prefix /cfx/server-address in the @Path of the resource class.
> For example:
> I used the following Spring bean xml 
>   <import resource="classpath:META-INF/cxf/cxf.xml" />
>     <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
>     <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
>     <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
>     <jaxrs:server id="helloworldService" address="/hello">
>         <jaxrs:serviceBeans>
>             <ref bean="helloworldSvc"/>
>         </jaxrs:serviceBeans>
>     </jaxrs:server>
>     <bean id="helloworldSvc" class=" com.test.HelloWorld"/>
> Then I had to use /cxf/hello EXACTLY in resource class like below:
> @Path("/cxf/hello")
> public class EquipmentRegistryService {
> 	
> 	 @GET
> 	 @Produces("text/html")
> 	 public String getXml() {
> 	        return "<html><body><h1>Hello World!</body></h1></html>";
> 	 }
> }
> If I changed the path to anything else(such as @Path("/greeting")), I got http 404. 
> In the non-OSGi environment, I am able to use relative path in the path annotation.
> For example: if the @Path("/greeting") is used, I can use /cxf/rest/hello/greeting to
reach the resource in non-OSGi environment.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message