1. There are two types of interface between Android app client and background: @POST and @get
@POST
@Path ("/updateuserdetail/")
@Consumes ("Application/x-www-form-urlencoded;encoding=utf-8")
@Override
Public Appbean Updateuserdetail (@FormParam ("username") String username,
@FormParam ("password") String password,
@FormParam ("occupation") String occupation,
@FormParam ("income") String income,
@FormParam ("email") String email,
@FormParam ("Phonenum") String Phonenum,
@FormParam ("married") String married) {}
------------------------------------------------------------------------------------------
@GET
@Path ("/goodslistbytype/{pageno}/{type}")
@Override
Public Appbean getgoodslist (@PathParam ("PageNo") String PageNo,
@PathParam ("type") String type) {}
-------------------------------------------------------------------------------------------
The @POST interface can be tested directly from the Address bar:
For example, the above interface, the address bar directly input:
http://localhost: Port number/project name/api/api/goodslistbytype/pageno/type/
The first API is a struts.xml configuration
(<constant name= "Struts.action.excludePattern" value= "/api/.*"/>),
The latter one is applicationcontext.xml configured
<jaxrs:server address= "/api" >
<jaxrs:serviceBeans>
<ref bean= "Appservice"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class= "Org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider"/>
</jaxrs:providers>
</jaxrs:server>
But the @get method is not directly in the path central to obtain, to borrow external tools or write a test class, of course, I chose the former, online Baidu found the big God said postman Google browser plug-in , their own groping to test, no longer worry about interface debugging.
The Get interface is as follows:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/77/04/wKioL1ZhDvHRDajGAACgVP3Wq38086.png "title=" Get.png "alt=" Wkiol1zhdvhrdajgaacgvp3wq38086.png "/>
The post interface is as follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/77/05/wKiom1ZhDqPTEx0xAADL145zZ5o542.png "title=" Post.png "alt=" Wkiom1zhdqptex0xaadl145zz5o542.png "/>
This article is from the "Qin Feng" blog, make sure to keep this source http://leoxia.blog.51cto.com/10825018/1719483
Interface test for Android and Java background