Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [maxq-dev] IAgent - pluggable HTTP agents

maxq
Discussion topic

Back to topic list

Re: [maxq-dev] IAgent - pluggable HTTP agents

Author hdara at primavera dot com
Full name hdara at primavera dot com
Date 2004-10-18 11:02:51 PDT
Message Good idea. In addition to Frank's comments,

- Why is getResponseText returning int? I presume it is simply a mistake,
but I would make it return a byte array.
- How about allowing these methods to throw some exceptions, such as
IOException, or network related ones? You could also think about create a
wrapper exception as part of the interface.
- get() and post() accepting Object type array is a bit obscure. How would
one pass name and value pairs? Also, can you pass null if you don't have
any parameters? Could you clarify on this?
- How about having setters for configuring proxy information too (Frank
just asked for getters).

Thanks,
Hari

Oliver Bock <oliver at g7 dot org> wrote on 10/18/2004 01:14:06 AM:

> Here is a first suggestion for a Java interface that identifies the
> minimum facilities that must be provided by HTTP libraries. This is
> motivated by a desire to experiment with HttpUnit without throwing away
> HttpClient. It may also be a useful way for Frank to invoke his own
> libraries while keeping MaxQ "clean".
>
> My intention is that the PyHttpTestCase would be extended to provide
> the helper methods currently provided by HttpTestCase, without knowing
> which HTTP library was in use. Examples of the helper functions
> include assert(), userConfirm(), responseContains(), etc.
>
> Thoughts?
>
>
> Oliver
>
> --
> package com.bitmechanic.maxq.agent;
>
> /**
> * This interface must be implemented by classes that act as agents
> (virtual
> * web browsers) for MaxQ scripts. An agent is created when a script
> is run.
> * As a minimum, it must support HTTP GET, POST and cookies.
> *
> * This interface is simpler than that typically provided by agent
> * implementations such as Jakarta HttpClient and HttpUnit. This keeps

> MaxQ
> * scripts simple. Implementors may expose other methods for use by
> more
> * sophisticated users who do not mind that their scripts will only
> work with
> * one agent. (e.g users who want HttpUnit's ability to look into the
> response
> * body.)
> *
> * MaxQ will "mix in" an implementations of this interface with the
> Jython base
> * class it provides for test (PyHttpTestCase). That is, it will
> dynamically
> * use the IAgent implementation as the top-level base class for the
> MaxQ
> * scripts.
> */
> public interface IAgent {
> /**
> * Performs an HTTP GET
> */
> public void get(String url, Object[] params);
>
> /**
> * Performs an HTTP POST
> */
> public void get(String url, Object[] params)
>
> /*
> * The headers from the response to the previous request.
> */
> public PyDictionary getResponseHeader();
>
> /*
> * The HTTP response code from the previous request (get()/post()).
> */
> public int getResponseCode();
>
> /*
> * The body of the response from the previous request
> (get()/post()).
> */
> public int getResponseText();
> }
>
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: dev-unsubscribe at maxq dot tigris dot org
> For additional commands, e-mail: dev-help at maxq dot tigris dot org
>


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: dev-unsubscribe at maxq dot tigris dot org
For additional commands, e-mail: dev-help at maxq dot tigris dot org

« Previous message in topic | 11 of 12 | Next message in topic »

Messages

Show all messages in topic

[maxq-dev] IAgent - pluggable HTTP agents oliverbock Oliver Bock 2004-10-18 01:14:06 PDT
     Re: [maxq-dev] IAgent - pluggable HTTP agents fcohen Frank Cohen 2004-10-18 09:41:39 PDT
         Re: [maxq-dev] IAgent - pluggable HTTP agents oliverbock Oliver Bock 2004-10-18 15:00:14 PDT
             Re: [maxq-dev] IAgent - pluggable HTTP agents fcohen Frank Cohen 2004-10-18 16:19:00 PDT
                 Re: [maxq-dev] IAgent - pluggable HTTP agents oliverbock Oliver Bock 2004-10-18 16:33:03 PDT
                     Re: [maxq-dev] IAgent - pluggable HTTP agents fcohen Frank Cohen 2004-10-18 16:40:42 PDT
                         Re: [maxq-dev] IAgent - pluggable HTTP agents oliverbock Oliver Bock 2004-10-18 16:46:26 PDT
                             Re: [maxq-dev] IAgent - pluggable HTTP agents fcohen Frank Cohen 2004-10-18 18:29:00 PDT
                                 Re: [maxq-dev] IAgent - pluggable HTTP agents oliverbock Oliver Bock 2004-10-18 18:47:04 PDT
                                     Re: [maxq-dev] IAgent - pluggable HTTP agents fcohen Frank Cohen 2004-10-18 19:19:08 PDT
     Re: [maxq-dev] IAgent - pluggable HTTP agents hdara at primavera dot com hdara at primavera dot com 2004-10-18 11:02:51 PDT
         Re: [maxq-dev] IAgent - pluggable HTTP agents oliverbock Oliver Bock 2004-10-18 15:19:16 PDT
Messages per page: