Hi massyl

Thank you for your example. 
Unfortunately we do not use Spring, so we have to initialize "jaxrs:server" 
whit Java directly. Therefore I use the Camel-Bean-Component. 

With following code, Camel is not started up. No exception/error is throwing 
:-/ So I don't know where the problem is. I think that my RestCamelBean is not 
correct.

Does someone know, what I'm doing wrong?


Route definition:
from("cxfrs:bean:restCamelBean")
     .log("-> JAX RS Request Body: \n: ${body}")
     .log("-> JAX RS Request headers: \n: ${headers}")
     .setBody(constant("REST Config is ok"));


I've tried to initialize the JAXRSServerFactoryBean like that:
public class RestCamelBean
{
    public RestCamelBean()
    {
        try
        {
            JAXRSServerFactoryBean bean = new JAXRSServerFactoryBean();
            bean.setResourceClasses(ValidationRestService.class);
            bean.setAddress("/");
            bean.setStart(true);
            bean.setTransportId(CxfBeanTransportFactory.TRANSPORT_ID);
            bean.create();
        }
        catch (Exception e)
        {
            e.printStackTrace(); 
        }
    }
}


My Rest-Server Interface looks like that:
@Path("/restService")
public interface ValidationRestService
{
    @GET
    @Path("/test")
    public String test();
}


web.xml is the same like yours:
    <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>/rest/*</url-pattern>
    </servlet-mapping>


So the Camel-Endpoint shold be adressed to 
http://servername/webRootContext/rest/restService/test

Would be great If someone could help me.

Greetings
Chris


-------- Original-Nachricht --------
> Datum: Fri, 16 Nov 2012 06:16:40 -0800 (PST)
> Von: massyl <[email protected]>
> An: [email protected]
> Betreff: Re: StackOverflowError when using restlet component with relative 
> path

> Hi chrispy,
> 
> Deploy a rest endpoint using CXFRS without launching a new server:
> 
> 1) add maven dependencies pom.xml (me i've added : camel-cxf,
> cxf-bundle-jaxrs and cxf-rt-frontend-jaxrs with cxf version      
> 
>     2.6.1)
> 
> 2) configure web.xm
>  <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>/rest/*</url-pattern> 
>     </servlet-mapping>
> 
> 3) add server bean in spring context
>  <jaxrs:server id="sampleResource" address="/">
>         <jaxrs:serviceBeans>
>             <bean class="com.example.rest.SampleResource" />
>         </jaxrs:serviceBeans>
>     </jaxrs:server>
> 
> 4) define a routeBuilder (in java or in xml)
>    from("cxfrs://bean://sampleResource")....to(...)
> 
> 5) your com.example.rest.SampleResource
> is jax-rs bean that exposes your uri.
> 
> ask if you encounter problems.
> cheers.
>  
> 
> 
> 
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/StackOverflowError-when-using-restlet-component-with-relative-path-tp5722101p5722865.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to