I'm sorry, but I'm not able to get this to work with 1.0.9.  I don't have a 
getServerDispatcher(), where is this?  On the context, I have just 
getDispatcher(), but that doesn't seem to be able to find a resource.
 
For now, I tried creating a client and calling the server, which works, but 
requires me to know the host and port, which locally I know, but when deployed, 
I will not know.  How to dynamically determine the app's host and port?
 
I think I'm going to try porting over to 1.1 and see if it'll work, but I have 
a feeling, my request will be rejected and we'll be using 1.0.9 till 1.1 is 
fully released.
 

Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
PROTECTED] <mailto:[EMAIL PROTECTED]>  | www.cerner.com 
<http://www.cerner.com/>  

 

________________________________

From: Rob Heittman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 14, 2008 4:12 PM
To: [email protected]
Subject: Re: Re: Calling a resource from another resource


Oops, RIAP may be introduced only in 1.1, I can't remember.  Certainly I quoted 
the 1.1 wiki docs.

Besides that, you'll need to substitute something like 
"riap://application/conditions" for just "riap://conditions"  The host part of 
the riap: pseudoprotocol is used to say whether the reference should be 
resolved relative to the context's Component, Application, or (now in trunk) 
VirtualHost.

Note that these are relative to the Context from which you get the dispatcher, 
so you may not be able to say //application if you are explicitly fetching the 
Component's context.  getContext().getClientDispatcher() is the usual way.

In the 1.0 tree, you'd need at least the ability to address the server 
dispatcher (getServerDispatcher()) to make an internal call of any sort.  Most 
of this internal-call goodness came about as the 1.1 effort was starting up 
though, so I don't rightly remember what's actually exposed in 1.0.x.

It is pretty straightforward to develop your solution with HTTP calls in 1.0 
and know you can trivially change them to RIAP calls for efficiency when you 
update to 1.1.

- Rob



On Wed, May 14, 2008 at 4:58 PM, Bao,Sam <[EMAIL PROTECTED]> wrote:


        Do you have any sample code that demonstrates the proper usage of the 
riap?  I'm running 1.0.9 so not all of the methods translate directly over to 
me, but this is what I'm doing inside of my Check Status Resource: 

        // Create a new Component.

        Component component = 

        new Component(); 

        

        

        // Attach the results application. 

        component.getDefaultHost().attach(

        "/conditions", ConditionsResource.class); 

        

        component.getContext().getDispatcher().get(

        "riap://conditions");
        I'm attach condition resource class to the "/conditions" path, and then 
calling a get on it right?

        Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | 
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  | www.cerner.com 
<http://www.cerner.com/>  

         

________________________________

        From: Rob Heittman [mailto:[EMAIL PROTECTED] 
        Sent: Wednesday, May 14, 2008 3:07 PM
        To: [email protected]
        Subject: Re: Calling a resource from another resource
        
        
        You almost certainly want to use the Restlet Internal Application 
Protocol (RIAP) 
http://wiki.restlet.org/docs_1.1/g1/13-restlet/48-restlet/86-restlet/90-restlet/45-restlet.html
        
        This avoids either the overhead of an external HTTP call or the risk of 
error and tight bindings associated with directly calling between objects.  
RIAP gets heavy exercise by my company and Marc Portier's, even if nobody else 
really knows about it yet  :-)
        
        - Rob
        
        
________________________________

        CONFIDENTIALITY NOTICE This message and any included attachments are 
from Cerner Corporation and are intended only for the addressee. The 
information contained in this message is confidential and may constitute inside 
or non-public information under international, federal, or state securities 
laws. Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.
        


Reply via email to