jersey的基本使用方法
来源:互联网 发布:女装淘宝销量排行榜 编辑:程序博客网 时间:2024/06/07 08:53
环境搭建:
1、jdk1.7
2、myeclipse
3、tomcat 7
4、mysql
从 Jersey 开发包中将以下库复制到 WEB-INF 下的库目录
- 核心服务器:jersey-core.jar,jersey-server.jar,jsr311-api.jar,asm.jar
- 核心客户端:(用于测试)jersey-client.jar
- JAXB 支持:(在高级样例中使用)jaxb-impl.jar,jaxb-api.jar,activation.jar,stax-api.jar,wstx-asl.jar
- JSON 支持:(在高级样例中使用)jersey-json.jar
配置环境
<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" id="WebApp_ID" version="2.5">
<display-name>jersey321</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>sample.hello.resources</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<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" id="WebApp_ID" version="2.5">
<display-name>jersey321</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>sample.hello.resources</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
在url-pattern中表示客户端要访问的url
在param-value中代表指定的包
然后就可以在指定的包写相应的代码
0 0
- jersey的基本使用方法
- jersey使用方法
- Vi 的基本使用方法
- log4j的基本使用方法
- 代理的基本使用方法
- log4j的基本使用方法
- jstl的基本使用方法
- pthread的基本使用方法
- 过滤器的基本使用方法
- MATLAB基本的使用方法
- vi的基本使用方法
- Statpack 的基本使用方法
- SeekBar的基本使用方法
- Intel_IPP的基本使用方法
- SeekBar的基本使用方法
- ListView的基本使用方法
- Notification的基本使用方法
- TotoiseSVN的基本使用方法
- flash的透明模式
- 对Java Serializable(序列化)的理解和总结
- linux 版本分类
- html5新功能4—JavaScript里获取电池状态的方法
- c++读写流及读写文件
- jersey的基本使用方法
- Software-artifact Infrastructure Repository 学习笔记 1 :C Object Directory Specification
- PHP源码阅读<1>
- memcached清除缓存
- NAN,IND,INF,DEN的概念
- leetcode || 64、Minimum Path Sum
- 【j2ee spring】16、Spring事务的传播行为
- Apache Spark MLlib学习笔记(一)MLlib数据存储Vector/Matrix/LablePoint
- 【在线研讨会 4月23日】2D到3D的跨越