Hi On Wed, Nov 24, 2010 at 2:56 PM, Ivan Vitoria Sanchez <[email protected] > wrote:
> Hi Sergey, > > I think the second one could be the best for me. However, as soon as I add > a > simple JAXBProvider bean to JAX-RS server, which still have the > JAXBDataBinding bean because i need it in order to use its "extraClass" > property for avoiding @XmlSeeAlso annotations, an exception is throwed: > > I see - so you;re actually referencing CXF JAXBDataBinding, presumably from JAX-RS DataBindingProvider. So what I have suggested won't work yet with the JAXBDataBinding. java.lang.ClassCastException: > sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to > java.lang.Class > > I hope this issue has gone away for good on the trunk now - several people reported it... > should i use the issue tracker instead of the mail? > > Can you open a JIRA and request an enhancement for an 'extraClass' property be supported at the JAXBElementProvider level ? This would probably require JAXBElementProvider to do what JAXBDataBinding does in that a single composite JAXBContext is created at the start-up. I'm not sure how to make it all work with JAXBDataBinding. There was a similar query (re extraClass) before and a user managed to extend JAXBElementProvider and override createJaxbContext() by adding an extra class... cheers, Sergey > Cheers, > > Ivan > > -----Mensaje original----- > De: Sergey Beryozkin [mailto:[email protected]] > Enviado el: miércoles, 24 de noviembre de 2010 14:22 > Para: [email protected] > Asunto: Re: Multiple outputs with just a POJO > > Hi Ivan > > I think XSLTJaxbProvider should do it well. > You can configure it with a map where keys are media types and values are > XSLT stylesheets, ex. > "application/legacy+xml" : "classpath:legacy.xslt", etc. > Assuming mobile, web app and legacy clients are all setting unique Accept > types then it will work very well. > > The other option, assuming all different types of clients are using > slightly > different URIs, ex, /main, /legacy, /mobile, is to create 3 jaxrs:endpoints > reusing the same bean instance but with custom per-endpoint specific > JAXBElementProvider providers which use "outTransformMap" property. For ex, > one provider allocated to a /mobile endpoint can be configured to ignore > all > the namespaces or ignore certain elements only, etc > > If neither of the above works for you then let us know how exactly you're > planning to find out the type of the current consumer and we'll figure > something out... > > cheers, Sergey > > On Wed, Nov 24, 2010 at 1:06 PM, Ivan Vitoria Sanchez < > [email protected] > > wrote: > > > Hi Sergey! > > > > I want to serve different XML data of the same POJO depending on who is > > requesting the service (a mobile, a web application, a legacy system...) > > > > Cheers, > > > > Ivan > > > > > > -----Mensaje original----- > > De: Sergey Beryozkin [mailto:[email protected]] > > Enviado el: miércoles, 24 de noviembre de 2010 13:53 > > Para: [email protected] > > Asunto: Re: Multiple outputs with just a POJO > > > > Hi > > > > On Wed, Nov 24, 2010 at 12:48 PM, Ivan Vitoria Sanchez < > > [email protected]> wrote: > > > > > Hello, > > > > > > I'm using JAXB as Apache CXF 2.3 JAX-RS DataBinding, both integrated > with > > > Spring 3. I'm not sure if it can be done but i would like to have > > different > > > outputs of the same POJO, which is annotated with JAXB. I think that > > > annotating interfaces doesn't seem to be the way (let me know if i am > > > wrong). > > > > > > > > Would you like different XML data be returned depending on the current > > request details ? > > Or would you like XML or JAXB-driven JSON be produced ? > > > > cheers, Sergey > > > > > Can anyone lend me a hand? > > > > > > Thanks in advance, > > > > > > > > > > > > > > > > > > *Ivan Vitoria Sanchez > > > > > > * > > > > > > *Districte 22@ - Complexe Ecourban - Edifici Blau* > > > > > > C / Almogàvers 119-123, 3º 4ª - 08018 Barcelona > > > > > > Tel. 93 452 02 65 Fax. 93 451 35 42 > > > > > > *[image: cid:[email protected]]* > > > > > > > > > > > >
