@GET |
Query request |
equivalent Data query operation in the database |
@POST |
insert request |
equivalent Insert data operation of database |
@PUT |
Update request |
equivalent to database Update data operation |
@DELETE |
delete request |
equivalent to data Delete data operation |
@Path |
uri path |
define resource access path , The client accesses resources through this path. For example: @Path(“user”) |
@Produces |
Specify the return MIME format |
Resources are returned according to that data format, and the possible values are: MediaType.APPLICATION_XXX. For example: @Produces(MediaType.APPLICATION_XML) |
@Consumes |
accepts the specified MIME format |
Only requests that meet this parameter setting can access this resource again. For example @Consumes(“application/x-www-form-urlencoded”) |
@PathParam |
uri path parameter |
is written in the method parameters to obtain the request path parameters. For example: @PathParam(“username”) String userName |
@QueryParam |
uri path request parameter |
Written in the parameters of the method to obtain the parameters attached to the request path. For example: @QueryParam(“desc”) String desc |
@DefaultValue |
Set the default value of @QueryParam parameters |
If @QueryParam does not receive a value, the default value is used. For example: @DefaultValue(“description”) @QueryParam(“desc”) String desc |
@FormParam |
form passed parameters |
Accept the parameters passed by the form. For example: @FormParam(“name”) String userName |
@BeanParam |
Pass parameters in the form of Bena |
< td align="left">accepts the bean type parameters passed by the client. At the same time, the bean can be configured with @FormParam on the attribute to solve the problem of inconsistency between the client’s attribute name and the bean’s attribute name. For example: @BeanParam User user
@Context |
Get some system environment information |
The following information can be obtained through @Context: UriInfo, ServletConfig, ServletContext, HttpServletRequest, HttpServletResponse, HttpHeaders, etc. |
@XmlRootElement |
will Convert bean to xml |
If you want to return the bean in xml or json format, this annotation is required. For example: @XmlRootElementpublic class User{…} |
@XmlElements |
|
< /td> |
@XmlElement |