Hello All:

I have a simple request, I just do not see how to do multiple requests.
The code below works, but is going to run very very slow.

request looks like this: 
"https://qqq-test.databridge.com/api/v1/documents.xml"; ; 
The problem is that there are up to 100 pages to be requested as follows:
 "https://wrinvestments-test.investorbridge.com/api/v1/documents.xml?page=2";
; 
 "https://wrinvestments-test.investorbridge.com/api/v1/documents.xml?page=3";
; 


If I call the code below for each request I see the HTTP client starting
each time.
May 16, 2011 12:00:48 PM org.restlet.engine.http.connector.HttpClientHelper
start
INFO: Starting the default HTTP client
Is it really starting each time?  I hope I am not starting dozens of these
HTTP clients.

Just a pointer or two on making this more efficient would be greatly
appreciated.

Thanks for your kind assistance.

KD





private xxResponse ibGet( String request_in, String  strxxUser_in, String
strxxPWord_in)   {
   ClientResource cr = null;
   xxResponse ibr = null;
   Representation represent  = null;
   String xxXML = null ;
                
   try {
        cr = new ClientResource( request_in );

      ChallengeScheme scheme = ChallengeScheme.HTTP_BASIC;   
      ChallengeResponse authentication = new ChallengeResponse(scheme,
strIBUser_in, strIBPWord_in );     
      cr.setChallengeResponse(authentication);
                         
      // Get the response
      represent = cr.get(MediaType.TEXT_XML);
      ibXML = represent.getText();
      if (ibXML != null) {
         System.out.println(ibXML);
      }
      System.out.println("** ** ** ** ** ** ** ** ** ");
                
     // Get the Status
     Status status = cr.getStatus();
     if (status != null) {
         System.out.println(status.toString());
      }
              
      ibr = new IBResponse( status, ibXML);    
  }
        
                
  catch( IOException ioEx ) {
        System.out.println(ioEx.getMessage() );
        ioEx.printStackTrace();
        //System.exit(1);
  }
                
  catch( ResourceException rex ) {
     ibr = new IBResponse( rex );
     System.out.println(rex.getMessage() );
     rex.printStackTrace();
        //System.exit(1);
 }
                
  if( null != represent){
        represent.release();
  }
  if (null != cr) {
        cr.release();
  }
                
 return ibr;
}
        

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Restlet-2-0-multiple-get-requests-tp6369368p6369368.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

Reply via email to