Stephen,

Do you know why this would return a 200, but yet it doesn't actually make the 
http call?

                Request request = getRequest();
            Reference rootRef = request.getRootRef();
            String rootURL = rootRef.getHostIdentifier();
            String rootPath = rootRef.getPath();
                //produces "http://<hostname>:<port>/<path>
            if (rootPath != null && rootPath.trim().length() > 0) {
                rootURL = rootURL + rootPath;
            }
            Client c = new Client(Protocol.HTTP);
            //test conditions resource
            if (TRACER.isEnabled()) {
                TRACER.trace("Test Conditions Resource");
            }
            c.start();
            Response r = c.get(rootURL + "/conditions");  <-------Calling 
another resource as if simulating a call from a client (ie firefox, ie, safari).
            c.stop();
            Status status = r.getStatus();
            if (TRACER.isEnabled()) {
                TRACER.trace("Status: " + status + ". Description: " + 
status.getDescription());
            }
            if (!Status.SUCCESS_OK.equals(status)) {
                throw new Exception("Conditions GET failed. Status: " + status 
+ ". Description: " + status.getDescription());
            } 

This code is inside a resource's GET, which then calls another resource in the 
same application.  When I run this piece locally in eclipse, alls fine, and the 
call to '/conditions' resource runs.  However, when I deployed this piece of 
code to Tomcat or Websphere, I get back a status of 200 (and no exception is 
thrown), but it doesn't appear that the '/conditions' resource actually gets 
called.  Anyone have a clue as to why?

>Sam Bao | Software Engineer | Cerner Corporation | 816.201.8242 | [EMAIL 
>PROTECTED] | www.cerner.com

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 14, 2008 3:00 PM
To: [email protected]
Subject: Re: Calling a resource from another resource

Hi Sam,

You could directly call the handle method of the Application, Router or 
whatever. You must ensure, that you set the right base ref of the Reference.
Otherwise you could create a Client and send a request to the own server.

best regards
   Stephan

Bao,Sam schrieb:
>
> Is it possible to call a resource from within another resource?  The 
> reasoning behind this is I want to create a Check Setup Resource, 
> where a user can go to this resource, and it will run a test GET, 
> POST, PUT, and DELETE on the other resources to make sure that 
> everything is set up, configured, deployed, and running correctly.
>

----------------------------------------------------------------------
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