当前的CXF配置:
<jaxrs:server id="rest" address="/path">
<jaxrs:serviceBeans>
<ref bean="myService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
</jaxrs:providers>
<jaxrs:inInterceptors>
<ref bean="restLogInterceptor" />
</jaxrs:inInterceptors>
和春天休息:
@Produces({ MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_JSON })
@Path("path")
public interface Service {
@GET
@Path("{id}")
Response inquire(@PathParam("id") String id);
@GET
@Path("{id}\aaa")
Response inquire(@PathParam("id") String id);
@GET
@Path("{id}\bbb")
Response inquire(@PathParam("id") String id);
@POST
@Path("{id}")
Response update(@PathParam("id") String id, Instruction instruction);
任何方式如何
我在第一个问题中并不完全理解你想要的东西。但是如果你想用相同的路径声明GET和POST方法,它的工作。 JAX-RS有@PathParam注释,它从请求中的路径得到参数。使用if语句可以创建不同的逻辑。