WebService 服务端的XML配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
 3   <servlet>
 4     <description>JAX-RS Tools Generated - Do not modify</description>
 5     <servlet-name>JAX-RS Servlet</servlet-name>
 6     <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
 7     <init-param>
 8       <param-name>com.sun.jersey.config.property.packages</param-name>
 9       <param-value>org.blog.ccnu.edu.webservice</param-value>
10     </init-param>
11     <load-on-startup>1</load-on-startup>
12   </servlet>
13   <servlet-mapping>
14     <servlet-name>JAX-RS Servlet</servlet-name>
15     <url-pattern>/jaxrs/*</url-pattern>
16   </servlet-mapping>
17 </web-app>

此处的url-pattern得注意了 它拦截后 我们在service配置的@path就把之前的略去,

比如localhost:8080/blog/jaxrs/userInfo/getUserInfoByUserName/

拦截后 我门自动找的path变为userInfo/getUserInfoByUserName/

如果我的url-pattern改成/* 那么拦截后找的path就变为jaxrs/userInfo/getUserInfoByUserName/

你可能感兴趣的:(webservice)