tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastian Daschner (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TOMEE-1535) JAX-RS Subresource paths are chosen incorrectly
Date Sun, 29 Mar 2015 11:52:53 GMT

    [ https://issues.apache.org/jira/browse/TOMEE-1535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14385725#comment-14385725
] 

Sebastian Daschner commented on TOMEE-1535:
-------------------------------------------

The logging and the behavior is wrong.
Sure, please see https://github.com/sdaschner/jaxrs-test.

The example returns following responses on TomEE:
GET .../resources/ -> "root"
GET .../resources/foobar -> "model_foobar"
GET .../resources/models -> "model_models"
GET .../resources/models/test -> "model_test"

But the correct responses should be:
GET .../resources/ -> "root" (this is correct)
GET .../resources/foobar -> 404 (because no path for foobar exists)
GET .../resources/models -> "all" (because ModelsResource#getAll should match)
GET .../resources/models/test -> "model_test" (this is correct)

It is clear what I mean?

> JAX-RS Subresource paths are chosen incorrectly
> -----------------------------------------------
>
>                 Key: TOMEE-1535
>                 URL: https://issues.apache.org/jira/browse/TOMEE-1535
>             Project: TomEE
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Sebastian Daschner
>
> When using a JAX-RS root resource with a subresource, the path of the subresources are
evaluated in a wrong way.
> Consider following code:
> @Stateless
> @Path("/")
> public class RootResource {
>     @Context
>     ResourceContext resourceContext;
>     @GET
>     public String getRoot() {
>         return "root";
>     }
>     @Path("models")
>     public ModelsResource models() {
>         return resourceContext.getResource(ModelsResource.class);
>     }
> }
> and:
> public class ModelsResource {
>     @GET
>     public String getAll() {
>         return "all";
>     }
>     @GET
>     @Path("{id}")
>     public String get(@PathParam("id") final String id) {
>         return "model_" + id;
>     }
> }
> The paths of the resources which TomEE evaluates are:
> /resources/       ->      String getRoot()
> /resources/       ->      String getAll()           
> /resources/{id}   ->      String get(String)
> But the correct way due to the spec would be
> /resources/models/ -> getAll() and
> /resources/models/{id} -> get(String).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message