Emmachen / SapUi5Test

1 stars 1 forks source link

@javax.ws.rs.Path("/wechat") #23

Open ghost opened 8 years ago

ghost commented 8 years ago

In our project code: clipboard1

注释类型 Path

@Target(value={TYPE,METHOD}) @Retention(value=RUNTIME) public @interface Path Identifies the URI path that a resource class or class method will serve requests for. Paths are relative. For an annotated class the base URI is the application path, see ApplicationPath. For an annotated method the base URI is the effective URI of the containing class. For the purposes of absolutizing a path against the base URI , a leading '/' in a path is ignored and base URIs are treated as if they ended in '/'. E.g.:

@Path("widgets")
public class WidgetsResource {
  @GET
  String getList() {...}

  @GET @Path("{id}")
  String getWidget(@PathParam("id") String id) {...}
}

In the above, if the application path is catalogue and the application is deployed at http://example.com/, then GET requests for http://example.com/catalogue/widgets will be handled by the getList method while requests for http://example.com/catalogue/widgets/nnn (where nnn is some value) will be handled by the getWidget method. The same would apply if the value of either @Path annotation started with '/'.

Classes and methods may also be annotated with Consumes and Produces to filter the requests they will receive.

see this link for more detail.

@javax.ws.rs.Consumes({ "text/xml" })

发送给资源的信息和传回客户端的信息都被指定了MIME媒体类型,是在HTTP request或response的头中指定的。可以使用下面的注解来指定资源能够响应或生产的MIME媒体类型: javax.ws.rs.Consumes javax.ws.rs.Produces

@javax.ws.rs.QueryParam

从URI中提取查询参数