Chapter 1. Getting Started(RETS helloworld)
来源:互联网 发布:飞儿乐队知乎 编辑:程序博客网 时间:2024/05/16 02:07
Jersey 1.12 User Guide
http://jersey.java.net/nonav/documentation/latest/index.html
新建Java类:
package sample.hello.resources;import javax.ws.rs.GET;import javax.ws.rs.Path;import javax.ws.rs.Produces;import javax.ws.rs.core.MediaType;@Path("/hello")public class HelloResource {@GET@Produces(MediaType.TEXT_PLAIN)public String sayHello() {return "Hello Jersey";}}配置web.xml文件:
<?xml version="1.0" encoding="UTF-8"?><web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <welcome-file-list> <welcome-file>index.jsp</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>WebService测试:
http://localhost:8080/testWeb/rest/hello
- Chapter 1. Getting Started(RETS helloworld)
- Chapter 1. Getting started
- Chapter 1. Getting Started
- Chapter 1. Getting Started(1)
- Chapter 1. Getting Started(2)
- Chapter one: Getting started
- Chapter 2 Getting Started
- Chapter 0: Getting started
- Chapter 1:Getting Started
- !!!Chapter 1 Getting Started
- Chapter 1. Getting Started with the Sample Application
- 《C++ primer中文版》Chapter 1. Getting Started 第一章 快速入门
- Chapter 1(2):Getting Started
- CMake Tutorial – Chapter 1: Getting Started
- Chapter 3: Getting Started With Devops
- Ruby-1.Getting Started
- 1.Getting Started
- 1.Getting Started
- Swing渐变生成工具
- jain-sip 开发文档
- windows C++程序员的知识体系
- HttpURLConnection的流式输出的缺陷和解决方法
- 数据库管理(一)
- Chapter 1. Getting Started(RETS helloworld)
- 第十七周实验报告1
- 第十七周实验报告
- PHP 数据过滤,遍历_REQUISE数组,返回为变量
- Core文件一二
- Ext JS 4学习教程+笔记(一)
- Java模仿Kugou,实现歌词秀
- 猩猿的快乐崛起
- 我与C++一起度过的日子