Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    
SUMMARY: REQUIRED | OPTIONAL DETAIL: ELEMENT

javax.ws.rs
Annotation Type BeanParam


@Target(value={PARAMETER,METHOD,FIELD})
@Retention(value=RUNTIME)
@Documented
public @interface BeanParam

The annotation that may be used to inject custom JAX-RS "parameter aggregator" value object into a resource class field, property or resource method parameter.

The JAX-RS runtime will instantiate the object and inject all it's fields and properties annotated with either one of the @XxxParam annotation (@PathParam, @FormParam ...) or the @Context annotation. For the POJO classes same instantiation and injection rules apply as in case of instantiation and injection of request-scoped root resource classes.

For example:

 public class MyBean {
   @FormParam("myData")
   private String data;

   @HeaderParam("myHeader")
   private String header;

   @PathParam("id")
   public void setResourceId(String id) {...}

   ...
 }

 @Path("myresources")
 public class MyResources {
   @POST
   @Path("{id}")
   public void post(@BeanParam MyBean myBean) {...}

   ...
 }
 

Because injection occurs at object creation time, use of this annotation on resource class fields and bean properties is only supported for the default per-request resource class lifecycle. Resource classes using other lifecycles should only use this annotation on resource method parameters.

Since:
2.0
Author:
Marek Potociar


Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    
SUMMARY: REQUIRED | OPTIONAL DETAIL: ELEMENT

Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.