基于CXF的JAX-WS、JAX-RS(RESTful)的webService

wangjianme 13年前
     <div>     <span style="font-size:medium;">1、准备</span>    </div>    <div>     <span style="font-size:medium;">这是一个最基本的基于CXF的Java项目<br /> 如果仅发布JAX-WS应用则需要以下jar文件 :<br /> cxf-2.4.2.jar                                 这是CXF的核心包<br /> xmlschema-core-2.0.jar              这是解析XMLSchema的apache包<br /> neethi-3.0.1.jar                          apache的WebService策略包<br /> wsdl4j-1.6.2.jar                          wsdl文件生成包<br /> servlet-api.jar                            此包就不用多说了吧。。</span>    </div>    <div>     <span style="font-size:medium;">jetty-util-7.4.5.v20110725.jar    //因为CXF使用内嵌的jetty服务器,以下都是jetty服务器包。<br /> jetty-server-7.4.5.v20110725.jar<br /> jetty-http-7.4.5.v20110725.jar<br /> jetty-io-7.4.5.v20110725.jar<br /> jetty-continuation-7.4.5.v20110725.jar</span>    </div>    <div>     <span style="font-size:medium;"> </span>    </div>    <div>     <span style="font-size:medium;">2、</span>    </div>    <div>     <span style="font-size:medium;">如果需要使用JAX-RS发布RESTful的服务则再添加以下jar文件 :<br /> jsr311-api-1.1.1.jar               /这是SUN公司发布的WebService的新标准,此JSR311包中包含了在类上应该添加什么注解如@Post<br /> 如果需要返回JSON类型的串则再需要加入<br /> jettison-1.3.jar                   //<br /> 因为cxf是用此类解析JSON串的。</span>    </div>    <div>     <span style="font-size:medium;"> (对于一个jax-rs应用,第一个方法必须返回一个JavaBean,<br />  不能没有返回值,且类上必须使用@XmlRootElement注解)</span>    </div>    <div>     <span style="font-size:medium;"> </span>    </div>    <div>     <span style="font-size:medium;"> (待续)</span>    </div>    <div>     <span style="font-size:medium;"> </span>    </div>    <div>     <span style="font-size:medium;">3、 </span>     <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;" class="O">      <span style="font-size:medium;"><span style="font-family:'Arial Black';color:#336666;font-size:16pt;mso-ascii-font-family:'Arial Black';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-color-index:3;mso-fareast-language:ZH-CN;" lang="EN-US">CXF</span><span style="font-family:宋体;color:#336666;font-size:16pt;mso-ascii-font-family:'Arial Black';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-color-index:3;">发布服务的类:</span></span>     </div>     <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;" class="O">      <span style="font-family:宋体;color:#336666;font-size:16pt;mso-ascii-font-family:'Arial Black';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-color-index:3;">       <div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:216;" class="O">         <span style="color:red;font-size:89%;"><span style="position:absolute;font-family:Wingdings;color:black;font-size:70%;top:0.39em;left:-4.45%;mso-color-index:1;mso-special-format:bullet;"><span style="font-size:medium;">l</span></span></span>         <span style="color:red;font-size:16pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">JaxWsServerFactoryBean </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:468;" class="O1">         <span><span style="position:absolute;color:#97cdcc;font-size:150%;top:-0.3em;left:-4.13%;mso-color-index:4;mso-special-format:bullet;"><span style="font-size:medium;">•</span></span><span style="font-size:medium;">JaxWsServerFactoryBean</span></span>         <span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">用于发布一个服务,可以通过默认构造实例此类。 </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:468;" class="O1">         <span style="color:red;font-size:78%;"><span style="position:absolute;color:#97cdcc;font-size:150%;top:-0.3em;left:-4.23%;mso-color-index:4;mso-special-format:bullet;"><span style="font-size:medium;">•</span></span></span>         <span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">它的方法如下: </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:468;" class="O1">         <span><span style="position:absolute;color:#97cdcc;font-size:150%;top:-0.3em;left:-4.23%;mso-color-index:4;mso-special-format:bullet;"><span style="font-size:medium;">•</span></span><span style="font-size:medium;">setServiceBean(Object) </span></span>         <span style="font-size:medium;"><span style="font-family:Arial;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">–</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"> </span><span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">设置一个服务对象</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"> - * </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:468;" class="O1">         <span><span style="position:absolute;color:#97cdcc;font-size:150%;top:-0.3em;left:-4.23%;mso-color-index:4;mso-special-format:bullet;"><span style="font-size:medium;">•</span></span><span style="font-size:medium;">setAddress(String url) </span></span>         <span style="font-size:medium;"><span style="font-family:Arial;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">–</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"> </span><span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">绑定一个地址和端口</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"> - * </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:468;" class="O1">         <span><span style="position:absolute;color:#97cdcc;font-size:150%;top:-0.3em;left:-4.23%;mso-color-index:4;mso-special-format:bullet;"><span style="font-size:medium;">•</span></span><span style="font-size:medium;">create()<span style="mso-spacerun:yes;">  </span>-<span style="mso-spacerun:yes;">  </span></span></span>         <span style="font-size:medium;"><span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">在</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">JavaSE</span><span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">环境下,使用</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">jetty</span><span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">发布</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">WebService. - * </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:468;" class="O1">         <span><span style="position:absolute;color:#97cdcc;font-size:150%;top:-0.3em;left:-4.23%;mso-color-index:4;mso-special-format:bullet;"><span style="font-size:medium;">•</span></span><span style="font-size:medium;">以下是可选方法</span></span>         <span style="font-size:medium;"><span style="font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"> </span><span style="font-family:宋体;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">: </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:468;" class="O1">         <span><span style="position:absolute;color:#97cdcc;font-size:150%;top:-0.3em;left:-4.23%;mso-color-index:4;mso-special-format:bullet;"><span style="font-size:medium;">•</span></span><span style="font-size:medium;">setServiceClass(Class cls) </span></span>         <span style="font-size:medium;"><span style="font-family:Arial;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">–</span><span style="font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"> </span><span style="font-family:宋体;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">设置服务对象实现的接口类。 </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:216;" class="O">         <span style="color:red;font-size:89%;"><span style="position:absolute;font-family:Wingdings;color:black;font-size:70%;top:0.39em;left:-4.45%;mso-color-index:1;mso-special-format:bullet;"><span style="font-size:medium;">l</span></span></span>         <span style="color:red;font-size:16pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">JaxRsServerFactoryBean </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:468;" class="O1">         <span><span style="position:absolute;color:#97cdcc;font-size:150%;top:-0.3em;left:-4.23%;mso-color-index:4;mso-special-format:bullet;"><span style="font-size:medium;">•</span></span><span style="font-size:medium;">此类用于发布</span></span>         <span style="font-size:medium;"><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">RESTful</span><span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">风格的</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">webService. </span></span>        </div>        <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'90 20 0';mso-margin-left-alt:468;" class="O1">         <span><span style="position:absolute;color:#97cdcc;font-size:150%;top:-0.3em;left:-4.19%;mso-color-index:4;mso-special-format:bullet;"><span style="font-size:medium;">•</span></span><span style="font-size:medium;">RESTful</span></span>         <span style="font-size:medium;"><span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">风格是以普通</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">get,post</span><span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">请求为标准的,并可以请求和响应</span><span style="color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">json</span><span style="font-family:宋体;color:red;font-size:14pt;mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">数据。 </span></span>        </div>       </div> </span>     </div>     <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;" class="O">      <span style="font-size:medium;"> </span>     </div>     <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;" class="O">      <span style="font-size:medium;">4、<span style="font-family:宋体;font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">使用</span><span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">CXF</span><span style="font-family:宋体;font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">发布一个服务 </span></span>     </div>     <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;" class="O">      <div class="O">       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-size:medium;"> </span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">package cn.leaf.one; </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import javax.jws.WebService; </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import org.apache.cxf.jaxws.JaxWsServerFactoryBean; </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">/** </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">使用</span><span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">CXF</span><span style="font-family:宋体;font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">发布一个服务 </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">必须要添加</span><span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">WebService</span><span style="font-family:宋体;font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">注解。否则不会对外暴露任何一个方法 </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="mso-spacerun:yes;"> </span>* @author </span><span style="font-family:宋体;font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">王健 </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>*/ </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">@WebService </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public class OneService { </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public String sayHi(){      ///此方法将会对外公布</span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">return "Good"; </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public static void main(String[] args) throws Exception { </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span><span style="font-size:medium;">JaxWsServerFactoryBean bean<span style="mso-spacerun:yes;">  </span>//使用</span></span>        <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">jaxWs</span><span style="font-family:宋体;font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">对其进行发布 </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span>  </span>= new JaxWsServerFactoryBean(); </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">bean.setServiceBean(new OneService()); </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">bean.setServiceClass(OneService.class); </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">bean.setAddress("http://localhost:4444/one"); </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">bean.create(); //内部使用jetty服务器做为支持</span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span><span style="font-size:medium;">System.err.println("服务启动成功。。</span></span>        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">"); </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">//Thread.sleep(1000*60*60); </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">//System.exit(0); </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">        <span style="font-family:'Times New Roman';font-size:9pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 50 0';">        <span style="font-size:medium;"> </span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 50 0';">        <span style="font-size:medium;">5、获取上面的wsdl文件:</span>        <a href="/misc/goto?guid=4959517853356380500" target="_blank"><span style="font-size:medium;">http://localhost:4444/one?wsdl</span></a>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 50 0';">        <span style="font-size:medium;">6、使用wsimport或是wsdl2java生成客户端调用代码,略。</span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 50 0';">        <span style="font-size:medium;">7、发布一个RESTful的webService</span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 50 0';">        <div class="O">         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">package cn.itcast.ws3; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import java.util.ArrayList; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import java.util.List; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import javax.ws.rs.FormParam; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import javax.ws.rs.GET; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import javax.ws.rs.POST; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import javax.ws.rs.Path; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import javax.ws.rs.PathParam; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import javax.ws.rs.Produces; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import javax.ws.rs.core.MediaType; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';"></div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import org.apache.cxf.interceptor.LoggingInInterceptor; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import org.apache.cxf.interceptor.LoggingOutInterceptor; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import cn.itcast.domain.User; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">/** </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">一个基于</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">JAX-RS</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">的服务 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="mso-spacerun:yes;"> </span>* JAX-RS</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">是无状态的服务 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">注意,必须要在</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">JavaBean</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">上添加</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">@XMLRootElemet</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">注解 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">此项目启动成功以后,可以通过以下方式访问: </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* <span style="color:#ff0000;">http://localhost:9004/users?_wadl&_type=xml </span></span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">注意是</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">_wadl&_type=xml </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">将返回一个如何调用</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">RESTful ws</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">的</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">wsdl</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">文件说明书 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="mso-spacerun:yes;"> </span>* @author </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">王健 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* @version 1.0 2011-11-18 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>*/ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">@Path(value="/users/")<span style="width:30%;mso-tab-count:2;"> </span>//</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">声明</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">uri</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">路径 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">@Produces(value={MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})//</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">声明支持的类型 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public class UserServiceRS { </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">private List<User> users = new ArrayList<User>(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public UserServiceRS(){ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">User u = new User(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">u.setAge(90); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">u.setName("</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">大家好</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">"); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">users.add(u); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">/** </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">以下代码,请在地址栏这样访问: </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* <span style="color:#ff0000;">http://localhost:9004/users/all/</span> </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">即会以</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">XML</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">形式显示所有用户信息 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* @return </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>*/ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">@GET </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">@Path(value="/all/") </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public List<User> getUsers(){ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">System.err.println("</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">调用了</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">users</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">方法</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">"); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">return users; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">/** </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">以下在地址栏输入: </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="color:#ff0000;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* http://localhost:9004/users/save/Tom/34 </span></span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="color:#ff0000;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span></span>          <span style="color:#ff0000;"><span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">其中:</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">Tom</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">为要保存的用户名</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">,34</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">为年龄 </span></span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">即会保存成功 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>*/ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">@GET </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">@Path(value="/save/{name}/{age}/") </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public User save(@PathParam("name")String name,@PathParam("age")String age){ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">User u = new User(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">u.setAge(Integer.parseInt(age)); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">u.setName(name); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">System.err.println("</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">保存成功</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">"+u); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">users.add(u); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">return u; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">/** </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">提供第二种保存方式 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="color:#ff0000;"><span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">使用</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">@FormParam</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">方式设置接收表单的参数 </span></span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">通过</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">HttpClient</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">调用,并设置请求参数 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>*/ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">@POST </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">@Path(value="/add/") </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public User add(@FormParam("name")String name,@FormParam("age")String age){ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">User u = new User(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">u.setAge(Integer.parseInt(age)); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">u.setName(name); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">System.err.println("</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">使用</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">POST</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">保存成功</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">"+u); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">users.add(u); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">return u; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';"></div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public static void main(String[] args) { </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">JAXRSServerFactoryBean bean = //</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">声明</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">JAXRS</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">服务对象 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">new JAXRSServerFactoryBean(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">bean.setServiceBean(new UserServiceRS());//</span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">加载服务类 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">bean.setAddress("http://localhost:9004/");//</span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">声明地址,注意只声明地址和端口即可 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">bean.getInInterceptors().add(new LoggingInInterceptor()); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">bean.getOutInterceptors().add(new LoggingOutInterceptor()); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">bean.create();//</span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">启动 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">System.err.println("JAX-RS</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">启动成功</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">...."); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';"></div>        </div>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 50 0';">        <span style="font-size:medium;">8、使用HttpClient调用RESTful的web服务:</span>       </div>       <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 50 0';">        <div class="O">         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">package cn.itcast.ws3; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';"></div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import org.apache.commons.httpclient.HttpClient; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import org.apache.commons.httpclient.methods.GetMethod; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">import org.apache.commons.httpclient.methods.PostMethod; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';"></div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">/** </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">使用</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">URLConnection</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">调用</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">RESTful</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">的服务 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">此外建议使用</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">httpClient</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">读取,将会更快 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="mso-spacerun:yes;"> </span>* </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">使用</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">urlConnection</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">可能没有返回结果 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-size:medium;"><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="mso-spacerun:yes;"> </span>* @author </span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">王健 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* @version 1.0 2011-11-18 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>*/ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public class UserRsClient { </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">UserRsClient() throws Exception{ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">save2(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">all(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">/** </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">查询所有信息 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* @throws Exception </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>*/ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">private void all() throws Exception{ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">GetMethod get = new GetMethod("http://localhost:9004/users/all"); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">get.setRequestHeader("accept","application/json"); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">HttpClient hc = new HttpClient(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">hc.getParams().setContentCharset("UTF-8");<span style="width:25.46%;mso-tab-count:2;"> </span>//</span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">设置编码 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">int code = hc.executeMethod(get); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">System.err.println("</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">返回的状态码:</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">"+code); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">if(code==200){ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">String str = get.getResponseBodyAsString(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">System.err.println("</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">返回信息:</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">\n"+str); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">get.releaseConnection(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">/** </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">保存一条信息</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">,</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">仍然使用</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">GET</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">方式 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>*/ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">private void save() throws Exception{ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">String name = "Jack";//</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">因为是</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">get</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">类型,所以不能包含中文 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">String age = "35"; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">String url = "http://localhost:9004/users/save/"+name+"/"+age; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">GetMethod get = new GetMethod(url); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">get.setRequestHeader("accept","application/json"); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">HttpClient hc = new HttpClient(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">hc.getParams().setContentCharset("UTF-8");<span style="width:25.46%;mso-tab-count:2;"> </span>//</span></span>          <span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">设置编码 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">//.setRequestHeader("Content","text/html;charset=UTF-8"); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">int code = hc.executeMethod(get); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">System.err.println("</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">返回的状态码是:</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">"+code); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">if(code==200){ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">String str = get.getResponseBodyAsString(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">System.err.println("</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">返回的信息是</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">:\n"+str); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">get.releaseConnection(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">/** </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>* </span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">以下使用</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">POST</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">方式 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;"><span style="mso-spacerun:yes;"> </span>*/ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">private void save2() throws Exception{ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">String name = "</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">王健</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">";//</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">因为是</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">get</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">类型,所以不能包含中文 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">String age = "35"; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">String url = "http://localhost:9004/users/add/"; </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">PostMethod pm = new PostMethod(url); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">pm.setRequestHeader("accept","application/json"); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">pm.setRequestHeader("Encoding","UTF-8"); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">pm.setParameter("name",name); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">pm.setParameter("age",age); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">HttpClient hc = new HttpClient(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">hc.getParams().setContentCharset("UTF-8");//</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">设置编码</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">,</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">否则会返回中文乱码</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">//TODO:</span><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">切记 </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;"><span style="font-size:medium;">int code = hc.executeMethod(pm); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">System.err.println("Post</span></span>          <span style="font-size:medium;"><span style="font-family:宋体;font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;">方式的返回值是</span><span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US">:"+code); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">if(code==200){ </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">String ss =<span style="mso-spacerun:yes;">  </span>pm.getResponseBodyAsString(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">System.err.println(">>:"+ss); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">pm.releaseConnection(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';"></div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';"></div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">public static void main(String[] args) throws Exception { </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">new UserRsClient(); </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">} </span></span>         </div>         <div style="mso-char-wrap:1;mso-kinsoku-overflow:1;mso-line-spacing:'80 30 0';">          <span style="font-family:'Times New Roman';font-size:8pt;mso-ascii-font-family:'Times New Roman';mso-fareast-font-family:宋体;mso-hansi-font-family:Arial;mso-fareast-language:ZH-CN;" lang="EN-US"><span style="font-size:medium;">}</span></span>         </div>        </div>       </div>      </div>     </div>    </div>