You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sonam Samdupkhangsar <So...@imail.org> on 2014/06/10 20:16:05 UTC

cxf jaxrs service listing page

I am using JavaConfig to setup without web.xml for service registration with JAXRSServerFactoryBean as following:

@Bean
    @DependsOn("cxf")
    public Server jaxRsServer(ApplicationContext appContext) {
       logger.debug("creating jaxrsServer");

        JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint(
                     jaxRsApiApplication(), JAXRSServerFactoryBean.class);

        factory.setServiceBeans(Arrays.<Object>asList(NoteRequestService, helloService()));
        factory.setAddress("/" + factory.getAddress());

        factory.setProvider(jsonProvider());
        return factory.create();
    }

In my WebAppInitializer I have registered the CXFServelet as following:

private void addApacheCxfServlet(ServletContext servletContext) {
               CXFServlet cxfServlet = new CXFServlet();

               ServletRegistration.Dynamic appServlet = servletContext.addServlet("CXFServlet", cxfServlet);
               appServlet.setLoadOnStartup(1);

               Set<String> mappingConflicts = appServlet.addMapping("/notes/*");
           }



When I visit the service listing page I am not seeing a proper list of services with their WADL links. I see the following currently:

Available RESTful services:
Endpoint address: http://localhost:8080/messaging/soa//
WADL : http://localhost:8080/notes/soa//?_wadl<http://localhost:8080/notes/soa/?_wadl>



Not sure what is wrong.  I am using CXF 3.0.0 version and I have the cxf-rt-rs-service-description jar in the pom as well.

Thanks
-Sonam



Re: cxf jaxrs service listing page

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 10/06/14 19:16, Sonam Samdupkhangsar wrote:
> I am using JavaConfig to setup without web.xml for service registration with JAXRSServerFactoryBean as following:
>
> @Bean
>      @DependsOn("cxf")
>      public Server jaxRsServer(ApplicationContext appContext) {
>         logger.debug("creating jaxrsServer");
>
>          JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint(
>                       jaxRsApiApplication(), JAXRSServerFactoryBean.class);
>
>          factory.setServiceBeans(Arrays.<Object>asList(NoteRequestService, helloService()));
>          factory.setAddress("/" + factory.getAddress());
>
>          factory.setProvider(jsonProvider());
>          return factory.create();
>      }
>
> In my WebAppInitializer I have registered the CXFServelet as following:
>
> private void addApacheCxfServlet(ServletContext servletContext) {
>                 CXFServlet cxfServlet = new CXFServlet();
>
>                 ServletRegistration.Dynamic appServlet = servletContext.addServlet("CXFServlet", cxfServlet);
>                 appServlet.setLoadOnStartup(1);
>
>                 Set<String> mappingConflicts = appServlet.addMapping("/notes/*");
>             }
>
>
>
> When I visit the service listing page I am not seeing a proper list of services with their WADL links. I see the following currently:
>
> Available RESTful services:
> Endpoint address: http://localhost:8080/messaging/soa//
> WADL : http://localhost:8080/notes/soa//?_wadl<http://localhost:8080/notes/soa/?_wadl>
>
>
>
> Not sure what is wrong.  I am using CXF 3.0.0 version and I have the cxf-rt-rs-service-description jar in the pom as well.
>

Looks like
"factory.setAddress("/" + factory.getAddress());"

cause a duplicate slash

Cheers, Sergey

> Thanks
> -Sonam
>
>
>