RE: RIAP Client from within my J2EE application (jboss)

2009-08-16 Thread Jerome Louvel
Hi Andew,

The pseudo RIAP protocol is supported internally by the Restlet engine and
doesn't require you to declare any client and server connector. That means
that in order to issue a RIAP call, you need to have a hold on your parent
Context instance.

In your case, it seems that Application.getCurrent() returns null because
the calling thread isn't the one that was initially processing the call, but
a Quartz worker thread instead. 

You would be stuck, but in Restlet 2.0 M4, we added RIAP client and server
connectors to support riap://component dispatching even when you have no
hold on the current context. This works using a RiapServerHelper singleton.

I suggest that you try again with Restlet 2.0 M4, looking at the attached
test case for guidance.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com




-Message d'origine-
De : Andrew Moore [mailto:rp.andrew.mo...@gmail.com] 
Envoyé : jeudi 30 juillet 2009 19:29
À : discuss@restlet.tigris.org
Objet : Re: RIAP Client from within my J2EE application (jboss)

I'm definitely still having issues... 

A little more background: we have a quartz job that calls a class which is
trying to make these requests. The Job class I created really has no context
for the my restlet application.  I'm not sure I'm creating my client
correctly... when I create it like this (which seems my only option since I
don't have access to a Context object):

Client riapClient = new Client(Protocol.RIAP);
riapClient.start();

I get a warning message:
WARNING: No available client connector supports the required protocols:
'RIAP' . Please add the JAR of a matching connector to your classpath.

I haven't seen a jar to add (and shouldn't this be part of the basic restlet
jar anyway?). When I try and start my client, a NullPointerException gets
thrown from somewhere inside the start() method. I'm assuming this is
probably due to not having a Context specified. But, I am having a hard time
trying to understand how I can get a Context object from my application. 

I haven't found any example code for instantiating and using an RIAP based
Client. I've seen (and used) RIAP requests from within a ServerResource to
another ServerResource, but not an RIAP request from a Client to the
ServerResource. 

I'm pretty sure I'm missing some sort of concept or using the Client in a
way it wasn't intended perhaps. 

Any help explaining what I'm missing or pointing me to some example code of
an RIAP Client that is sitting on the server-side would be greatly
appreciated! 

Regards,

Andrew
-- 
View this message in context:
http://n2.nabble.com/RIAP-Client-from-within-my-J2EE-application-%28jboss%29
-tp3353312p3357728.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=23770
64

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2384073

RiapConnectorsTestCase.java
Description: Binary data


Re: RIAP Client from within my J2EE application (jboss)

2009-08-16 Thread Tim Peierls
On Sun, Aug 16, 2009 at 11:32 AM, Jerome Louvel
jerome.lou...@noelios.comwrote:

 In your case, it seems that Application.getCurrent() returns null because
 the calling thread isn't the one that was initially processing the call,
 but
 a Quartz worker thread instead.


I don't know enough about Quartz to give details, but after a quick scan at
the Quartz javadocs, I bet that a technique similar to that used in
Restlet's TaskService class could be used to wrap a Quartz Scheduler to make
sure that all Jobs execute with a current Application.

--tim

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2384083

Re: RIAP Client from within my J2EE application (jboss)

2009-07-30 Thread Andrew Moore
Thanks, I'll give that a shot and let you know if it works or what I'm still
stuck on.

Regards,

Andrew
-- 
View this message in context: 
http://n2.nabble.com/RIAP-Client-from-within-my-J2EE-application-%28jboss%29-tp3353312p3356788.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2376983


Re: RIAP Client from within my J2EE application (jboss)

2009-07-30 Thread Andrew Moore
I'm definitely still having issues... 

A little more background: we have a quartz job that calls a class which is
trying to make these requests. The Job class I created really has no context
for the my restlet application.  I'm not sure I'm creating my client
correctly... when I create it like this (which seems my only option since I
don't have access to a Context object):

Client riapClient = new Client(Protocol.RIAP);
riapClient.start();

I get a warning message:
WARNING: No available client connector supports the required protocols:
'RIAP' . Please add the JAR of a matching connector to your classpath.

I haven't seen a jar to add (and shouldn't this be part of the basic restlet
jar anyway?). When I try and start my client, a NullPointerException gets
thrown from somewhere inside the start() method. I'm assuming this is
probably due to not having a Context specified. But, I am having a hard time
trying to understand how I can get a Context object from my application. 

I haven't found any example code for instantiating and using an RIAP based
Client. I've seen (and used) RIAP requests from within a ServerResource to
another ServerResource, but not an RIAP request from a Client to the
ServerResource. 

I'm pretty sure I'm missing some sort of concept or using the Client in a
way it wasn't intended perhaps. 

Any help explaining what I'm missing or pointing me to some example code of
an RIAP Client that is sitting on the server-side would be greatly
appreciated! 

Regards,

Andrew
-- 
View this message in context: 
http://n2.nabble.com/RIAP-Client-from-within-my-J2EE-application-%28jboss%29-tp3353312p3357728.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2377064


Re: RIAP Client from within my J2EE application (jboss)

2009-07-29 Thread Rob Heittman
Can you try riap://host instead of riap://component and see if that works
for you?  This is kind of cargo cult advice but we have mainly changed to
that, and it works.  Untested hypothesis: component/application context
visibility issues (added for security reasons around 1.2M2 IIRC) prevent you
from using riap://component from an Application context.

On Wed, Jul 29, 2009 at 7:44 PM, Andrew Moore rp.andrew.mo...@gmail.comwrote:

 I thought at one point I could call the static method getCurrent() on my
 Application (i.e. MyRestletApplication.getCurrent()) and then make my riap
 request through there:


 MyRestletApplication.getCurrent().getContext().getClientDispatcher().get(riap://component/path-to-my-resource)



--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2376774