[JERSEY-1570] Resoure.from(Object resource, List<ResourceModelIssue> issueList) does not create Resource based on instance (Object resource) Created: 09/Nov/12  Updated: 12/Dec/12  Resolved: 11/Dec/12

Status: Resolved
Project: jersey
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0-m11, 2.0

Type: Bug Priority: Critical
Reporter: Miroslav Fuksa Assignee: Miroslav Fuksa
Resolution: Works as designed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: 3 hours
Original Estimate: 3 hours


 Description   

This code does not store instance but only uses the class of the instance (the instance is ignored):

    public static Resource from(Object resource, List<ResourceModelIssue> issueList) {
        final Builder builder = new IntrospectionModeller(resource.getClass(), issueList).createResourceBuilder(true);
        return builder.isEmpty() ? null : builder.build();
    }

MethodHadnler is then class based and not instance based.

The instance should be kept and used for request dispatching.



 Comments   
Comment by Miroslav Fuksa [ 11/Dec/12 ]

Finally agreed with Marek that the current functionality works as desired. We do not want to create Resources which have instance based Method Handler. Preferable way it to create class based resources and register instance as a singleton.

So, current methods (Resource.from(Object) and Resource.builder(Object)) are really intended to create class based method handlers.

Generated at Sun May 24 23:48:46 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.