cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Lipp <Christian.L...@xion.at>
Subject URL structure
Date Fri, 29 Jun 2012 05:54:35 GMT
Hello!

I am implementing a REST service with CXF and I want to have the following URL structure:

-  dog/34
- dog/current/34
- cat/34
- index.html

So I registered CXFServlet with url-pattern /*, but provided a static-resources-list:

	<servlet>
		<servlet-name>CXFServlet</servlet-name>
		<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
		<init-param>
			<param-name>static-resources-list</param-name>
			<param-value>/(\w)+.html</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>CXFServlet</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>

My service is a single class with
@Path("/")
public class AnimalService
{
	@GET
	@Path("/dog/current/{idnr}")
	public Response getCurrentBoneForDog(
	...

The service works fine, I can reach index.html by http://server/app/index.html, but I would
also like to get it with http://server/app
I tried to provide
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
	</welcome-file-list>

but this doesn't work either.

In the logs I find
o.apache.cxf.jaxrs.utils.JAXRSUtils - No operation matching request path "/app/" is found,
Relative Path: /, HTTP Method: GET, ContentType: */*

Is it able to set a "default handler", so when no operation matching request path is set then
it delegates to standard mechanism?
Is it possible to solve my requirement with CXF mechanism? The only thing I can think of is
to provide two servlet mappings with "/dog/*" and /cat/*" which would mean that I also had
to split my service class into two parts.

Kind regards,
Christian

Mime
View raw message