You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jason Wang <ja...@gmail.com> on 2013/11/20 22:30:13 UTC
Mysterious Jax-rs URL root path
Hi all,
I am working on a bunch of Restful services at the moment. I would like
them to have a common root which is /rsservice/*.
One of my server setting is like this:
<jaxrs:server id="protectedServers" address="/rsservice/v1/">
<jaxrs:serviceBeans>
<ref bean="accountRS"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="finzOAuthRequestFilter"/>
</jaxrs:providers>
</jaxrs:server>
So I would expect they appear under
http://mydomain.com/myapp/rsservice/v1/*
However, it somehow magically appeared under
http://mydomain.com/myapp/wsservice/rsservice/v1/*
I could not figure out how the root got changed to wsservice. Thats the
root I use for soap web services, I did not expect that would affect my
jax-rs servers.
Any idea how to fix?
My web.xml:
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/rsservice/*</url-pattern>
<url-pattern>/wsservice/*</url-pattern>
</servlet-mapping>
Another question is, is there a way to list all jax-rs service urls? I used
Enunciate for documenting my soap APIs which actually servers this purpose
but I am just courious if there is a standard way to do this..
Thanks
Jason
Re: Mysterious Jax-rs URL root path
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 20/11/13 21:30, Jason Wang wrote:
> Hi all,
>
> I am working on a bunch of Restful services at the moment. I would like
> them to have a common root which is /rsservice/*.
>
> One of my server setting is like this:
>
> <jaxrs:server id="protectedServers" address="/rsservice/v1/">
> <jaxrs:serviceBeans>
> <ref bean="accountRS"/>
> </jaxrs:serviceBeans>
> <jaxrs:providers>
> <ref bean="finzOAuthRequestFilter"/>
> </jaxrs:providers>
> </jaxrs:server>
>
> So I would expect they appear under
>
> http://mydomain.com/myapp/rsservice/v1/*
>
> However, it somehow magically appeared under
>
> http://mydomain.com/myapp/wsservice/rsservice/v1/*
>
> I could not figure out how the root got changed to wsservice. Thats the
> root I use for soap web services, I did not expect that would affect my
> jax-rs servers.
>
> Any idea how to fix?
>
> My web.xml:
>
> <servlet-mapping>
> <servlet-name>CXFServlet</servlet-name>
> <url-pattern>/rsservice/*</url-pattern>
> <url-pattern>/wsservice/*</url-pattern>
> </servlet-mapping>
>
I think it is the first time I see a multiple URL pattern in action :-).
FYI, JAX-RS will accumulate servlet pattern and jaxrs;address, see
http://cxf.apache.org/docs/jax-rs.html#JAX-RS-HowRequestURIisMatched
You can have a single CXF servlet listening on * and jaxws - on
/wsservice and jaxrs - on /rsservice, this will give you what you
expect, or have two CXF servlets, one - on /rsservice, another one - on
/wsservice
> Another question is, is there a way to list all jax-rs service urls? I used
> Enunciate for documenting my soap APIs which actually servers this purpose
> but I am just courious if there is a standard way to do this..
I know users do some work with Enunciate, Swagger feature has been
added, WADL auto-gen is available
Sergey
>
> Thanks
> Jason
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com