"Java" @Produces annotation translation __java

Source: Internet
Author: User

Import javax.ws.rs.Produces;

* * * Produces.java * Created on September, 2006, 2:40 PM * * Package javax.ws.rs;
Import Java.lang.annotation.ElementType;
Import java.lang.annotation.Inherited;
Import java.lang.annotation.Retention;
Import Java.lang.annotation.RetentionPolicy;

Import Java.lang.annotation.Target; /** * Defines the media type (s) that the methods of a resource class or * {@link javax.ws.rs.ext.MessageBodyWriter} can
 Produce.
 * If not specified then a container would assume that any type can be produced. * Method level annotations Override a class level annotation. A Container * is responsible for ensuring this method invoked is capable of producing * one of the media types Reque Sted in the HTTP request. 
 If no such method are * available The container must respond with a HTTP ' 406 not acceptable ' as * specified by RFC 2616. * <p>a method for which there is A single-valued <code>Produces</code> * are not required to set th E Media type of representations that it prodUCEs: * The container would use the value of the <code>Produces</code> when * sending a response.</p> * * @see Javax.ws.rs.ext.MessageBodyWriter//defines the resource type or the Messagebodywriter media type generation method; If there is no special statement, then a container will assume that any type can be produced; The annotation level of the method overrides the class annotation level, and a container is responsible for guaranteeing the referenced method, which enables the production of a request media type in an HTTP request. In the absence of such a method, the container responds to HTTP with a "406 not acceptable" message;//A single valued produces method is not required to set the type of media that represents his production: when sending a response request, The container will use the produces value. For details, see the Javax.ws.rs.ext.MessageBodyWriter @Inherited @Target ({elementtype.type, elementtype.method}) @Retention ( Retentionpolicy.runtime) Public @interface produces {/** * A list of media types. Each entry could specify a single type or consist * of a comma separated list of types. e.g. {"Image/jpeg,image/gif", * "Image/png"}.
     Use of the comma-separated form allows the definition of a * common string constant to use on multiple targets. * A range of media types. Each entry may specifically prescribe a single type or separate a series of types with commas, such as {"Image/jpeg,image/gif", * "Image/png"} * allow a comma-delimited form to define an ordinary string-type constant.To use the multimedia target */string[] value () default "*/*";
 }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.