[jbosstools-issues] [JBoss JIRA] (JBIDE-16825) Provide support for new @BeanParam JAX-RS Annotation
Xavier Coulon (JIRA)
issues at jboss.org
Mon May 26 05:47:57 EDT 2014
[ https://issues.jboss.org/browse/JBIDE-16825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12970402#comment-12970402 ]
Xavier Coulon commented on JBIDE-16825:
---------------------------------------
Having a JAX-RS Resource as below:
{code}
@GET()
@Path("/{id1}/{id2}")
@Produces(MediaType.TEXT_PLAIN)
public String get(@BeanParam MyPathParams pathParams,
@BeanParam MyQueryParams queryParams) {
...
}
{code}
along with BeanParam classes such as:
{code}
/**
* @author xcoulon
*
*/
public class MyPathParams {
@PathParam("id1")
private String id1;
private String id2;
public String getId1() {
return id1;
}
public void setId1(String id1) {
this.id1 = id1;
}
public String getId2() {
return id2;
}
@PathParam("id2")
public void setId2(String id2) {
this.id2 = id2;
}
}
{code}
and
{code}
public class MyQueryParams {
@QueryParam("param1")
private String param1;
@QueryParam("param2")
private String param2;
@QueryParam("param3")
private String param3;
public String getParam1() {
return param1;
}
public String getParam2() {
return param2;
}
public String getParam3() {
return param3;
}
}
{code}
works fine when deployed on WildFly 8, but the JAX-RS Tooling has the following issues:
- the JAX-RS Validator reports warnings claiming that path parameters "id1" and "id2" are not bound. They are, but via the {{MyPathParams}} class
- in the JAX-RS Project Explorer view, the computed Endpoint URI misses the query params, although they can be retrieved via the {{MyQueryParams}} class.
> Provide support for new @BeanParam JAX-RS Annotation
> ----------------------------------------------------
>
> Key: JBIDE-16825
> URL: https://issues.jboss.org/browse/JBIDE-16825
> Project: Tools (JBoss Tools)
> Issue Type: Sub-task
> Components: webservices
> Affects Versions: 4.1.1.Final
> Reporter: Xavier Coulon
> Assignee: Xavier Coulon
> Fix For: 4.2.0.Beta2
>
>
> See JAX-RS Spec Appendix A (p66):
> BeanParam
> {quote}
> Can be used to inject a user-defined bean whose fields and properties may be annotated with JAX-RS param annotations.
> {quote}
> For example:
> {code}
> public class MyBeanParam {
> @PathParam("p")
> private String pathParam;
>
> @MatrixParam("m")
> @Encoded
> @DefaultValue("default")
> private String matrixParam;
>
> @HeaderParam("header")
> private String headerParam;
>
> private String queryParam;
>
> public MyBeanParam(@QueryParam("q") String queryParam) {
> this.queryParam = queryParam;
> }
>
> public String getPathParam() {
> return pathParam;
> }
> ...
> }
> {code}
> then
> {code}
> @POST
> public void post(@BeanParam MyBeanParam beanParam, String entity) {
> final String pathParam = beanParam.getPathParam(); // contains injected path parameter "p"
> ...
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
More information about the jbosstools-issues
mailing list