You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Nick Maynard (JIRA)" <ji...@apache.org> on 2010/09/03 12:50:33 UTC
[jira] Created: (WINK-310) Annotations inherited by a resource
class should determine parameter type from the subclass, not the superclass
Annotations inherited by a resource class should determine parameter type from the subclass, not the superclass
---------------------------------------------------------------------------------------------------------------
Key: WINK-310
URL: https://issues.apache.org/jira/browse/WINK-310
Project: Wink
Issue Type: Improvement
Components: Server
Affects Versions: 1.1
Reporter: Nick Maynard
I have a generic service interface, like so:
public interface GenericService<T> {
@POST
@Consumes(MediaType.APPLICATION_JSON)
public void doSomething(T obj);
}
And an implementation of the interface, like so:
@Path("/impl")
public class Impl implements GenericService<RealJAXBType> {
public void doSomething(RealJAXBType obj) {
// blah blah
}
}
RealJAXBType is annotated as a JAXB XMLRootElement. For information's
sake, I'm using Apache Wink 1.1 with Jackson 1.5.5.
When I call the service exposed by the Wink servlet, Wink attempts to
deserialize the passed JSON content to an HashMap of some description, not
a RealJAXBType. I assume that's because the @POST annotation is on the
generic interface. My guess is that Wink picks up the "class" of T, which
is of course Object (as generic type T isn't scoped), and based on this,
attempts a best-effort conversion into a HashMap, which is incompatible
with the implementation's type of RealJAXBType.
I've verified this happens for an abstract superclass as well as an
interface, so I guess it's to do with the annotation inheritance code.
This seems unintuitive - I'd certainly expect Wink to look at the
implementation parameter's class when deciding what to attempt to
deserialise the JSON content into. Ideally, I'd like Wink to heed the
type of the implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WINK-310) Annotations inherited by a resource
class should determine parameter type from the subclass, not the superclass
Posted by "Mike Rheinheimer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Rheinheimer resolved WINK-310.
-----------------------------------
Fix Version/s: 1.1.2
Resolution: Fixed
SVN rev 992311.
> Annotations inherited by a resource class should determine parameter type from the subclass, not the superclass
> ---------------------------------------------------------------------------------------------------------------
>
> Key: WINK-310
> URL: https://issues.apache.org/jira/browse/WINK-310
> Project: Wink
> Issue Type: Improvement
> Components: Server
> Affects Versions: 1.1
> Reporter: Nick Maynard
> Assignee: Mike Rheinheimer
> Fix For: 1.1.2
>
> Attachments: WINK-310.patch
>
>
> I have a generic service interface, like so:
> public interface GenericService<T> {
> @POST
> @Consumes(MediaType.APPLICATION_JSON)
> public void doSomething(T obj);
> }
> And an implementation of the interface, like so:
> @Path("/impl")
> public class Impl implements GenericService<RealJAXBType> {
> public void doSomething(RealJAXBType obj) {
> // blah blah
> }
> }
> RealJAXBType is annotated as a JAXB XMLRootElement. For information's
> sake, I'm using Apache Wink 1.1 with Jackson 1.5.5.
> When I call the service exposed by the Wink servlet, Wink attempts to
> deserialize the passed JSON content to an HashMap of some description, not
> a RealJAXBType. I assume that's because the @POST annotation is on the
> generic interface. My guess is that Wink picks up the "class" of T, which
> is of course Object (as generic type T isn't scoped), and based on this,
> attempts a best-effort conversion into a HashMap, which is incompatible
> with the implementation's type of RealJAXBType.
> I've verified this happens for an abstract superclass as well as an
> interface, so I guess it's to do with the annotation inheritance code.
> This seems unintuitive - I'd certainly expect Wink to look at the
> implementation parameter's class when deciding what to attempt to
> deserialise the JSON content into. Ideally, I'd like Wink to heed the
> type of the implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WINK-310) Annotations inherited by a resource
class should determine parameter type from the subclass, not the superclass
Posted by "Mike Rheinheimer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Rheinheimer updated WINK-310:
----------------------------------
Attachment: WINK-310.patch
Thanks Nick. Attached is the patch, with test. I've already committed it in SVN rev 992311, so you should see it in the snapshots soon.
Please let me know if this satisfies your request, and close out the Jira.
I like the construct you suggested. Please feel free to post more suggestions to the dev list and Jira. We'd love to hear more feedback.
> Annotations inherited by a resource class should determine parameter type from the subclass, not the superclass
> ---------------------------------------------------------------------------------------------------------------
>
> Key: WINK-310
> URL: https://issues.apache.org/jira/browse/WINK-310
> Project: Wink
> Issue Type: Improvement
> Components: Server
> Affects Versions: 1.1
> Reporter: Nick Maynard
> Assignee: Mike Rheinheimer
> Attachments: WINK-310.patch
>
>
> I have a generic service interface, like so:
> public interface GenericService<T> {
> @POST
> @Consumes(MediaType.APPLICATION_JSON)
> public void doSomething(T obj);
> }
> And an implementation of the interface, like so:
> @Path("/impl")
> public class Impl implements GenericService<RealJAXBType> {
> public void doSomething(RealJAXBType obj) {
> // blah blah
> }
> }
> RealJAXBType is annotated as a JAXB XMLRootElement. For information's
> sake, I'm using Apache Wink 1.1 with Jackson 1.5.5.
> When I call the service exposed by the Wink servlet, Wink attempts to
> deserialize the passed JSON content to an HashMap of some description, not
> a RealJAXBType. I assume that's because the @POST annotation is on the
> generic interface. My guess is that Wink picks up the "class" of T, which
> is of course Object (as generic type T isn't scoped), and based on this,
> attempts a best-effort conversion into a HashMap, which is incompatible
> with the implementation's type of RealJAXBType.
> I've verified this happens for an abstract superclass as well as an
> interface, so I guess it's to do with the annotation inheritance code.
> This seems unintuitive - I'd certainly expect Wink to look at the
> implementation parameter's class when deciding what to attempt to
> deserialise the JSON content into. Ideally, I'd like Wink to heed the
> type of the implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WINK-310) Annotations inherited by a resource
class should determine parameter type from the subclass, not the superclass
Posted by "Nick Maynard (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12905848#action_12905848 ]
Nick Maynard commented on WINK-310:
-----------------------------------
>From Mike Rheinheimer, on dev mailing list:
At first glance, I think you're right; that Wink should support the
construct you've implemented. Can you open an improvement Jira for
this?
The accumulation of metadata for the methods declared in the resource
class registered should be improved. I have an idea for a solution.
> Annotations inherited by a resource class should determine parameter type from the subclass, not the superclass
> ---------------------------------------------------------------------------------------------------------------
>
> Key: WINK-310
> URL: https://issues.apache.org/jira/browse/WINK-310
> Project: Wink
> Issue Type: Improvement
> Components: Server
> Affects Versions: 1.1
> Reporter: Nick Maynard
>
> I have a generic service interface, like so:
> public interface GenericService<T> {
> @POST
> @Consumes(MediaType.APPLICATION_JSON)
> public void doSomething(T obj);
> }
> And an implementation of the interface, like so:
> @Path("/impl")
> public class Impl implements GenericService<RealJAXBType> {
> public void doSomething(RealJAXBType obj) {
> // blah blah
> }
> }
> RealJAXBType is annotated as a JAXB XMLRootElement. For information's
> sake, I'm using Apache Wink 1.1 with Jackson 1.5.5.
> When I call the service exposed by the Wink servlet, Wink attempts to
> deserialize the passed JSON content to an HashMap of some description, not
> a RealJAXBType. I assume that's because the @POST annotation is on the
> generic interface. My guess is that Wink picks up the "class" of T, which
> is of course Object (as generic type T isn't scoped), and based on this,
> attempts a best-effort conversion into a HashMap, which is incompatible
> with the implementation's type of RealJAXBType.
> I've verified this happens for an abstract superclass as well as an
> interface, so I guess it's to do with the annotation inheritance code.
> This seems unintuitive - I'd certainly expect Wink to look at the
> implementation parameter's class when deciding what to attempt to
> deserialise the JSON content into. Ideally, I'd like Wink to heed the
> type of the implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WINK-310) Annotations inherited by a resource
class should determine parameter type from the subclass, not the superclass
Posted by "Mike Rheinheimer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907632#action_12907632 ]
Mike Rheinheimer commented on WINK-310:
---------------------------------------
Sure Nick, you can grab the latest SNAPSHOTS of most projects from the Maven snapshots repository after Hudson builds:
http://repository.apache.org/snapshots/
The latest Wink snapshot is here:
http://repository.apache.org/snapshots/org/apache/wink/apache-wink/1.1.2-incubating-SNAPSHOT/
> Annotations inherited by a resource class should determine parameter type from the subclass, not the superclass
> ---------------------------------------------------------------------------------------------------------------
>
> Key: WINK-310
> URL: https://issues.apache.org/jira/browse/WINK-310
> Project: Wink
> Issue Type: Improvement
> Components: Server
> Affects Versions: 1.1
> Reporter: Nick Maynard
> Assignee: Mike Rheinheimer
> Fix For: 1.1.2
>
> Attachments: WINK-310.patch
>
>
> I have a generic service interface, like so:
> public interface GenericService<T> {
> @POST
> @Consumes(MediaType.APPLICATION_JSON)
> public void doSomething(T obj);
> }
> And an implementation of the interface, like so:
> @Path("/impl")
> public class Impl implements GenericService<RealJAXBType> {
> public void doSomething(RealJAXBType obj) {
> // blah blah
> }
> }
> RealJAXBType is annotated as a JAXB XMLRootElement. For information's
> sake, I'm using Apache Wink 1.1 with Jackson 1.5.5.
> When I call the service exposed by the Wink servlet, Wink attempts to
> deserialize the passed JSON content to an HashMap of some description, not
> a RealJAXBType. I assume that's because the @POST annotation is on the
> generic interface. My guess is that Wink picks up the "class" of T, which
> is of course Object (as generic type T isn't scoped), and based on this,
> attempts a best-effort conversion into a HashMap, which is incompatible
> with the implementation's type of RealJAXBType.
> I've verified this happens for an abstract superclass as well as an
> interface, so I guess it's to do with the annotation inheritance code.
> This seems unintuitive - I'd certainly expect Wink to look at the
> implementation parameter's class when deciding what to attempt to
> deserialise the JSON content into. Ideally, I'd like Wink to heed the
> type of the implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WINK-310) Annotations inherited by a resource
class should determine parameter type from the subclass, not the superclass
Posted by "Nick Maynard (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907584#action_12907584 ]
Nick Maynard commented on WINK-310:
-----------------------------------
Mike,
That's great, thanks! Is there any way we can download a build that includes this patch for testing?
Thanks,
Nick
> Annotations inherited by a resource class should determine parameter type from the subclass, not the superclass
> ---------------------------------------------------------------------------------------------------------------
>
> Key: WINK-310
> URL: https://issues.apache.org/jira/browse/WINK-310
> Project: Wink
> Issue Type: Improvement
> Components: Server
> Affects Versions: 1.1
> Reporter: Nick Maynard
> Assignee: Mike Rheinheimer
> Fix For: 1.1.2
>
> Attachments: WINK-310.patch
>
>
> I have a generic service interface, like so:
> public interface GenericService<T> {
> @POST
> @Consumes(MediaType.APPLICATION_JSON)
> public void doSomething(T obj);
> }
> And an implementation of the interface, like so:
> @Path("/impl")
> public class Impl implements GenericService<RealJAXBType> {
> public void doSomething(RealJAXBType obj) {
> // blah blah
> }
> }
> RealJAXBType is annotated as a JAXB XMLRootElement. For information's
> sake, I'm using Apache Wink 1.1 with Jackson 1.5.5.
> When I call the service exposed by the Wink servlet, Wink attempts to
> deserialize the passed JSON content to an HashMap of some description, not
> a RealJAXBType. I assume that's because the @POST annotation is on the
> generic interface. My guess is that Wink picks up the "class" of T, which
> is of course Object (as generic type T isn't scoped), and based on this,
> attempts a best-effort conversion into a HashMap, which is incompatible
> with the implementation's type of RealJAXBType.
> I've verified this happens for an abstract superclass as well as an
> interface, so I guess it's to do with the annotation inheritance code.
> This seems unintuitive - I'd certainly expect Wink to look at the
> implementation parameter's class when deciding what to attempt to
> deserialise the JSON content into. Ideally, I'd like Wink to heed the
> type of the implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (WINK-310) Annotations inherited by a resource
class should determine parameter type from the subclass, not the superclass
Posted by "Mike Rheinheimer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike Rheinheimer reassigned WINK-310:
-------------------------------------
Assignee: Mike Rheinheimer
> Annotations inherited by a resource class should determine parameter type from the subclass, not the superclass
> ---------------------------------------------------------------------------------------------------------------
>
> Key: WINK-310
> URL: https://issues.apache.org/jira/browse/WINK-310
> Project: Wink
> Issue Type: Improvement
> Components: Server
> Affects Versions: 1.1
> Reporter: Nick Maynard
> Assignee: Mike Rheinheimer
>
> I have a generic service interface, like so:
> public interface GenericService<T> {
> @POST
> @Consumes(MediaType.APPLICATION_JSON)
> public void doSomething(T obj);
> }
> And an implementation of the interface, like so:
> @Path("/impl")
> public class Impl implements GenericService<RealJAXBType> {
> public void doSomething(RealJAXBType obj) {
> // blah blah
> }
> }
> RealJAXBType is annotated as a JAXB XMLRootElement. For information's
> sake, I'm using Apache Wink 1.1 with Jackson 1.5.5.
> When I call the service exposed by the Wink servlet, Wink attempts to
> deserialize the passed JSON content to an HashMap of some description, not
> a RealJAXBType. I assume that's because the @POST annotation is on the
> generic interface. My guess is that Wink picks up the "class" of T, which
> is of course Object (as generic type T isn't scoped), and based on this,
> attempts a best-effort conversion into a HashMap, which is incompatible
> with the implementation's type of RealJAXBType.
> I've verified this happens for an abstract superclass as well as an
> interface, so I guess it's to do with the annotation inheritance code.
> This seems unintuitive - I'd certainly expect Wink to look at the
> implementation parameter's class when deciding what to attempt to
> deserialise the JSON content into. Ideally, I'd like Wink to heed the
> type of the implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WINK-310) Annotations inherited by a resource
class should determine parameter type from the subclass, not the superclass
Posted by "Hudson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906402#action_12906402 ]
Hudson commented on WINK-310:
-----------------------------
Integrated in Wink-Trunk-JDK1.5 #380 (See [https://hudson.apache.org/hudson/job/Wink-Trunk-JDK1.5/380/])
WINK-310: support inheritance for method signatures whose parent uses generic types
> Annotations inherited by a resource class should determine parameter type from the subclass, not the superclass
> ---------------------------------------------------------------------------------------------------------------
>
> Key: WINK-310
> URL: https://issues.apache.org/jira/browse/WINK-310
> Project: Wink
> Issue Type: Improvement
> Components: Server
> Affects Versions: 1.1
> Reporter: Nick Maynard
> Assignee: Mike Rheinheimer
> Fix For: 1.1.2
>
> Attachments: WINK-310.patch
>
>
> I have a generic service interface, like so:
> public interface GenericService<T> {
> @POST
> @Consumes(MediaType.APPLICATION_JSON)
> public void doSomething(T obj);
> }
> And an implementation of the interface, like so:
> @Path("/impl")
> public class Impl implements GenericService<RealJAXBType> {
> public void doSomething(RealJAXBType obj) {
> // blah blah
> }
> }
> RealJAXBType is annotated as a JAXB XMLRootElement. For information's
> sake, I'm using Apache Wink 1.1 with Jackson 1.5.5.
> When I call the service exposed by the Wink servlet, Wink attempts to
> deserialize the passed JSON content to an HashMap of some description, not
> a RealJAXBType. I assume that's because the @POST annotation is on the
> generic interface. My guess is that Wink picks up the "class" of T, which
> is of course Object (as generic type T isn't scoped), and based on this,
> attempts a best-effort conversion into a HashMap, which is incompatible
> with the implementation's type of RealJAXBType.
> I've verified this happens for an abstract superclass as well as an
> interface, so I guess it's to do with the annotation inheritance code.
> This seems unintuitive - I'd certainly expect Wink to look at the
> implementation parameter's class when deciding what to attempt to
> deserialise the JSON content into. Ideally, I'd like Wink to heed the
> type of the implementation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.