Hi all

i am getting crazy trying  to implement a simple cxf/rest/jaxrs sample

----------------------------
Encoding: UTF-8
Content-Type:
Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive],
accept-language=[fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3], host=[127.0.0.1:9000],
accept-charset=[ISO-8859-1,utf-8;q=0.7,*;q=0.7], user-a
gent=[Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.5)
Gecko/2008120122 Firefox/3.0.5],
cookie=[JSESSIONID=BA3E7DC589DD8205260B42A3588B1F49],
Accept=[text/html,application/xhtml+xml,applicatio
n/xml;q=0.9,*/*;q=0.8], keep-alive=[300]}
Payload:
--------------------------------------
2009-07-13 17:30:37,519 : JAXRSInInterceptor.processRequest : .No root
resource matching request path /state/idle is found.
2009-07-13 17:30:37,535 : WebApplicationExceptionMapper.toResponse :
WebApplicationException has been caught : no cause is available
2009-07-13 17:30:37,566 : LoggingOutInterceptor$LoggingCallback.onClose :
Outbound Message

any idea ?

thx
Bruno

i use cxf 2.2.3 + spring 2.5 + jaxrs 2.2

my class impl

@Path("/status")
@Produces("application/xml")
public class WebStatusImpl  {

    public WebCallManagerPcLineImpl() {

    }
    public Response getBadRequest() {
        // TODO Auto-generated method stub
        return null;
    }

    @GET
    @Path("/state/{action}")
    @Produces("application/xml")
    public StatusResponse getState(@PathParam("action") String action) {
        // TODO Auto-generated method stub
        StatusResponse result = new statusResponse();
        result.setStatus("idle");

        return result;
    }
 }



and my cxf.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xmlns:cxf="http://cxf.apache.org/core";
     xmlns:jaxrs="http://cxf.apache.org/jaxrs";
     xmlns:jaxws="http://cxf.apache.org/jaxws";
     xsi:schemaLocation="http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd";
    default-lazy-init="false">


    <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-servlet.xml" />


    <jaxrs:server id="status" address="/">
        <jaxrs:features>
             <cxf:logging/>
        </jaxrs:features>
        <jaxrs:serviceBeans>
            <ref bean="statusserviceImpl" />
        </jaxrs:serviceBeans>
        <jaxrs:extensionMappings>
            <entry key="xml" value="application/xml" />
        </jaxrs:extensionMappings>
    </jaxrs:server>

    <bean id="statusserviceImpl" class="com.service.StatusServiceImpl" />

</beans>


and my web.xml

  <context-param>
      <param-name>webAppRootKey</param-name>
      <param-value>cxf.rest.statusservice.root</param-value>
  </context-param>
   <context-param>
    <param-name>contextConfigLocation</param-name>
  <param-value>WEB-INF/cxf.xml</param-value>
  </context-param>

  <listener>
    <listener-class>
      org.springframework.web.context.ContextLoaderListener
    </listener-class>
  </listener>
  <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>
        org.apache.cxf.transport.servlet.CXFServlet
    </servlet-class>
     <load-on-startup>1</load-on-startup> </servlet>
  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

</web-app>


and my url enter in Firefox
http://127.0.0.1:9000/statusservice /status/state/idle

Reply via email to