Summary of common annotations of WebService

< 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

Annotation Function Description
@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
@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

< td>@GET

< 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

Annotation Function Description
Query request Equivalent to database query data operation
@POST Insert request Equivalent to database insert data operation
@PUT Update request Equivalent to database update data operation
@ DELETE Deletion request Equivalent to data deletion operation
@Path uri path defines the resource access path through which the client accesses the resource. 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
@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

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3502 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.