[errai-dev] Problems I encountered while using Errai and JAX-RS

Christian Sadilek csadilek at redhat.com
Mon Nov 5 16:34:37 EST 2012


Overriding the type to make it compile without having the methods do something meaningful should be easy.  We already have a bunch of overrides in the errai-java-enterprise project. However, I think we can try to make it work. We probably need to have Errai generate code for that. Here's the link to the JIRA https://issues.jboss.org/browse/ERRAI-431. 

Yes, you are more than welcome to help! We will need the override for either solution.

Cheers,
Christian

On 2012-11-05, at 4:17 PM, Daniel Sachse <sachsedaniel at gmail.com> wrote:

> Hey,
> 
> the quick fix sounds good to me :) Could live with that for a while ;)
> That would be a really nice workaround to connect my current legacy code. Could I help in making this happen without having a deep knowledge of the internals of Errai?
> 
> Cheers,
> 
> Daniel
> 
> Am 05.11.2012 um 22:09 schrieb Christian Sadilek <csadilek at redhat.com>:
> 
>> Hey,
>> 
>> Well if we just override the JAX-RS Response class to make it compile without actually implementing the getStatus and getEntity methods, then you'd still need to use GWT's Response type and call marshalling yourself. This is for a quick fix. Of course I will aim to make these methods work on the client when overriding the type. So, you would not need to call marshalling yourself.
>> 
>> Cheers,
>> Christian
>> 
>> On 2012-11-05, at 3:54 PM, Daniel Sachse <sachsedaniel at gmail.com> wrote:
>> 
>>> Hey Christian,
>>> 
>>> well, if I want to create the entity from a response by hand, I also need to send a response in some way.  I am fine with calling the Marshaller myself with the code you provided, but atm I am unable to send a Response, because the compiler doesn´t know javax.ws.rs.core.Response. 
>>> If you would override the JAX-RS Response, would I also need to call the Marshalling myself or would this work out of the box?
>>> 
>>> Cheers,
>>> 
>>> Daniel
>>> 
>>> Am 05.11.2012 um 19:38 schrieb Christian Sadilek <csadilek at redhat.com>:
>>> 
>>>> Hi Daniel,
>>>> 
>>>> I think we can make the JAX-RS Response type work by overriding it. The internal ResponseBuilder needs to be stripped out etc. because I guess building a response on the client isn't very useful. However, I    can't promise it for 2.2.0 but I will try.
>>>> 
>>>> Accessing the entity using a plain GWT response should be possible but you will need to call the marshaller yourself e.g. Marshalling.fromJson(response.getText(), MyEntity.class); or use MarshallingWrapper if you use Jackson instead of Errai's JSON.
>>>> 
>>>> Cheers,
>>>> Christian
>>>> 
>>>> 
>>>> On 2012-11-05, at 12:42 PM, Daniel Sachse <sachsedaniel at gmail.com> wrote:
>>>> 
>>>>> Hi Christian,
>>>>> 
>>>>> First problem:
>>>>> I could also live with GWT´s Response type, if I could access the entity I provided with my REST Response. Unfortunately this doesn´t seem to be possible.
>>>>> I want to stay DRY and I don´t want to implement REST services especially for the ERRAI frontend. At the moment I am trying to implement another frontend for my existing application with Errai.
>>>>> 
>>>>> Second problem:
>>>>> Yes I have seen the conversation and I always make my decorators dependent. Unfortunately the conversation didn´t help me :(
>>>>> Well, which information would you need about my beans? I am just trying to have a normal interface attached with JAX-RS annotations, a normal "@Dependent" scoped REST service and a decorator. I don´t inject anything all. Just decorating a plain REST implementation with some mock data.
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Daniel
>>>>> 
>>>>> 
>>>>> Am 05.11.2012 um 16:42 schrieb Christian Sadilek <csadilek at redhat.com>:
>>>>> 
>>>>>> Hi Daniel,
>>>>>> 
>>>>>> Yes, the javax.ws.rs.core.Response object is not GWT-translatable. We could try and workaround this by overriding the type (we already did this for various other but simpler EE classes). Nobody requested this yet but it might be worth doing. GWT's Response type is somewhat similar from a client's point of view and can be used in a callback (see https://docs.jboss.org/author/display/ERRAI/Handling+Responses)
>>>>>> 
>>>>>> The second problem seems to imply that the CDI Decorators have to be dependent-scoped. Did you see this conversation:
>>>>>> http://transcripts.jboss.org/channel/irc.freenode.org/%23weld-dev/2011/%23weld-dev.2011-10-17.log
>>>>>> 
>>>>>> Can you share more information about your beans? You can also post it to the errai or the weld forums, of course.
>>>>>> 
>>>>>> Cheers,
>>>>>> Christian
>>>>>> 
>>>>>> On 2012-11-05, at 6:50 AM, Daniel Sachse <sachsedaniel at gmail.com> wrote:
>>>>>> 
>>>>>>> Hey guys,
>>>>>>> 
>>>>>>> I wanted to sum up some problems I ran into while using Errai and JAX-RS.
>>>>>>> 
>>>>>>> I normally use the javax.ws.rs.core.Response Object in my REST services to return different Status codes depending on custom conditions. Unfortunately I get compiler errors telling me : "No source code is available for type javax.ws.rs.core.Response; did you forget to inherit a required module?". Any ideas about that?
>>>>>>> Using Interfaces with JAX-RS annotations like @Path, @GET, etc. with "normal" Object responses work fine so far. BUT, as soon as I try to attach CDI decorators to such an Interface, Weld complains with:  "org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001306 Attempting to inject an unproxyable normal scoped bean Decorator….", although the implementation is perfectly proxyable. Did anybody experience something similar?
>>>>>>> 
>>>>>>> Some technical infos:
>>>>>>> I am using JBoss 7.1.1.Final and Errai 2.1.1.Final.
>>>>>>> 
>>>>>>> Hope somebody knows anything :)
>>>>>>> 
>>>>>>> Regards,
>>>>>>> 
>>>>>>> Daniel (w0mbat)
>>>>>>> _______________________________________________
>>>>>>> errai-dev mailing list
>>>>>>> errai-dev at lists.jboss.org
>>>>>>> https://lists.jboss.org/mailman/listinfo/errai-dev
>>>>>> 
>>>>>> _______________________________________________
>>>>>> errai-dev mailing list
>>>>>> errai-dev at lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/errai-dev
>>>>> 
>>>>> _______________________________________________
>>>>> errai-dev mailing list
>>>>> errai-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/errai-dev
>>>> 
>>>> _______________________________________________
>>>> errai-dev mailing list
>>>> errai-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/errai-dev
>>> 
>>> _______________________________________________
>>> errai-dev mailing list
>>> errai-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/errai-dev
>> 
>> _______________________________________________
>> errai-dev mailing list
>> errai-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/errai-dev
> 
> _______________________________________________
> errai-dev mailing list
> errai-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/errai-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/errai-dev/attachments/20121105/f1bc34f6/attachment-0001.html 


More information about the errai-dev mailing list