You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Kaloyan Kolev (JIRA)" <ji...@apache.org> on 2009/10/21 10:33:59 UTC

[jira] Updated: (WINK-218) GenericEntity's generic type is not used when choosing provider.

     [ https://issues.apache.org/jira/browse/WINK-218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kaloyan Kolev updated WINK-218:
-------------------------------

          Component/s: Common
          Description: 
I have created a subclass of the AtomEntry, let's say XAtomEntry. When I return that as an entity resource I get exception that there is no provider for that type. The exception is thrown by FlushResultHandler. I tried to wrap the new type in a GenericEntity with a generic type set to AtomEntry, but the result was the same.

Here is the check for the GenericEntity:
{code}
 Class<?> rawType = null;

        if (entity instanceof GenericEntity) {
            GenericEntity<?> genericEntity = (GenericEntity<?>)entity; 
            entity = genericEntity.getEntity(); // this is the XAtomEntity instance
            rawType = genericEntity.getRawType(); // this is the  XAtomEntity class
            genericType = genericEntity.getType(); // this is the AtomEntity class
        } else {
            rawType = (entity != null ? entity.getClass() : null);
            if (isOriginalEntityResponseObj) {
                genericType = rawType;
            } else {
                genericType = (genericType != null ? genericType : rawType);
            }
        }
{code}

This should match the default JAXBXmlProvider, right? 

Later a provider is searched for:
{code}
// get the provider to write the entity
        Providers providers = context.getProviders();
        MessageBodyWriter<Object> messageBodyWriter =
            (MessageBodyWriter<Object>)providers.getMessageBodyWriter(rawType,
                                                                      genericType,
                                                                      declaredAnnotations,
                                                                      responseMediaType);
{code}

Here the messageBodyWriter is set to null.
    Affects Version/s: 0.2
              Summary: GenericEntity's generic type is not used when choosing provider.  (was: GenericEntity')

> GenericEntity's generic type is not used when choosing provider.
> ----------------------------------------------------------------
>
>                 Key: WINK-218
>                 URL: https://issues.apache.org/jira/browse/WINK-218
>             Project: Wink
>          Issue Type: Bug
>          Components: Common
>    Affects Versions: 0.2
>            Reporter: Kaloyan Kolev
>
> I have created a subclass of the AtomEntry, let's say XAtomEntry. When I return that as an entity resource I get exception that there is no provider for that type. The exception is thrown by FlushResultHandler. I tried to wrap the new type in a GenericEntity with a generic type set to AtomEntry, but the result was the same.
> Here is the check for the GenericEntity:
> {code}
>  Class<?> rawType = null;
>         if (entity instanceof GenericEntity) {
>             GenericEntity<?> genericEntity = (GenericEntity<?>)entity; 
>             entity = genericEntity.getEntity(); // this is the XAtomEntity instance
>             rawType = genericEntity.getRawType(); // this is the  XAtomEntity class
>             genericType = genericEntity.getType(); // this is the AtomEntity class
>         } else {
>             rawType = (entity != null ? entity.getClass() : null);
>             if (isOriginalEntityResponseObj) {
>                 genericType = rawType;
>             } else {
>                 genericType = (genericType != null ? genericType : rawType);
>             }
>         }
> {code}
> This should match the default JAXBXmlProvider, right? 
> Later a provider is searched for:
> {code}
> // get the provider to write the entity
>         Providers providers = context.getProviders();
>         MessageBodyWriter<Object> messageBodyWriter =
>             (MessageBodyWriter<Object>)providers.getMessageBodyWriter(rawType,
>                                                                       genericType,
>                                                                       declaredAnnotations,
>                                                                       responseMediaType);
> {code}
> Here the messageBodyWriter is set to null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.