[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openejb-cvs
Subject:    [jira] [Commented] (TOMEE-1535) JAX-RS Subresource paths are chosen incorrectly
From:       "Sebastian Daschner (JIRA)" <jira () apache ! org>
Date:       2015-03-29 15:28:53
Message-ID: JIRA.12786512.1427618049000.62722.1427642933118 () Atlassian ! JIRA
[Download RAW message or body]


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

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

Yes, implementing getClasses (with only the RootResource class) helped. :-)
Anyway, only the RootResource should be considered as a root resource class (due to \
JSR 339 Chapter 1.5) and not the subresource class (in lack of a @Path annotation), \
agreed? So this step shouldn't be necessary, right?

> 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)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic