[
https://issues.jboss.org/browse/JBIDE-18710?page=com.atlassian.jira.plugi...
]
Xavier Coulon updated JBIDE-18710:
----------------------------------
Description:
The generated code in the 'create' method contains something like this:
{code}
return Response.created(
UriBuilder.fromResource(Session.class)
.path(String.valueOf(session.getId())).build()).build();
{code}
but the {{Session.class}} should be {{SessionEndpoint.class}} since it must be the
resource class annotated with {{@Path}}
Also, after discussion with [~maxandersen], here the plan to fix this issue:
- if the {{create}} method generation is selected and the target entity is selected and
contains a 'getId()' method, then generate the following method body:
{code}
//TODO: process the given pojo
// here we use Pojo#getId(), assuming it provides the end-user with the identifier to
retrieve the created Pojo resource
Response.created(UriBuilder.fromResource(PojoEndpoint.class).path(String.valueOf(pojo.getId())).build())
.build();
{code}
- if the {{create}} method generation is selected and the target entity is selected and
*does not contain* a 'getId()' method, then generate the following method body:
{code}
//TODO: process the given pojo
// you may want to do something like this
// return
Response.created(UriBuilder.fromResource(PojoEndpoint.class).path(String.valueOf(pojo.getId())).build();
// assuming that Pojo#getId() or a similar method would provide the end-user with the
identifier to retrieve the created Pojo resource
Response.created(null).build();
{code}
If no target entity is provided, there is no way to generate the method skeletons.
was:
The generated code in the 'create' method contains something like this:
{code}
return Response.created(
UriBuilder.fromResource(Session.class)
.path(String.valueOf(session.getId())).build()).build();
{code}
but the {{Session.class}} should be {{SessionEndpoint.class}} since it must be the
resource class annotated with {{@Path}}
Invalid generated code in JAX-RS Endpoint
-----------------------------------------
Key: JBIDE-18710
URL:
https://issues.jboss.org/browse/JBIDE-18710
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: webservices
Affects Versions: 4.2.0.Final
Reporter: Xavier Coulon
Assignee: Xavier Coulon
Fix For: 4.2.1.Final, 4.3.0.Alpha1
The generated code in the 'create' method contains something like this:
{code}
return Response.created(
UriBuilder.fromResource(Session.class)
.path(String.valueOf(session.getId())).build()).build();
{code}
but the {{Session.class}} should be {{SessionEndpoint.class}} since it must be the
resource class annotated with {{@Path}}
Also, after discussion with [~maxandersen], here the plan to fix this issue:
- if the {{create}} method generation is selected and the target entity is selected and
contains a 'getId()' method, then generate the following method body:
{code}
//TODO: process the given pojo
// here we use Pojo#getId(), assuming it provides the end-user with the identifier to
retrieve the created Pojo resource
Response.created(UriBuilder.fromResource(PojoEndpoint.class).path(String.valueOf(pojo.getId())).build())
.build();
{code}
- if the {{create}} method generation is selected and the target entity is selected and
*does not contain* a 'getId()' method, then generate the following method body:
{code}
//TODO: process the given pojo
// you may want to do something like this
// return
Response.created(UriBuilder.fromResource(PojoEndpoint.class).path(String.valueOf(pojo.getId())).build();
// assuming that Pojo#getId() or a similar method would provide the end-user with the
identifier to retrieve the created Pojo resource
Response.created(null).build();
{code}
If no target entity is provided, there is no way to generate the method skeletons.
--
This message was sent by Atlassian JIRA
(v6.3.8#6338)