Spring Restfull Jax-RS 注释支持
我有以下类和网络.xml文件。spring 框架是否支持 jax-rs 注释,如 、 和 、 ...等。@PATH
@PUT
@Consumes
换句话说,我可以用代替@PATH
@RequestMapping
爪哇岛:
import org.springframework.stereotype.Controller;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
@Controller
@Path("/register")
public class RegisterServices {
@PUT
@Path("/create")
@Consumes(MediaType.APPLICATION_JSON)
@Produces({"application/json"})
public Response create(@Context HttpServletRequest requestContex,
@HeaderParam("Authorization") String authorization,
String xMsisdn, String param) {}
}
网.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>