I agree that we should be able to share implementations of HttpEntity. The difference would be how the client and server sides populate and use these classes.

Mike

On Jan 20, 2005, at 8:06 AM, Ortwin Gl�ck wrote:

Roland,

I agree on a dedicated class for HttpEntity. But I think in- and outgoing fits nicer into a decorator pattern. I am not sure how in- and outgoing would differ from each other. Ideas?:

the common interface:
IHttpEntity interface

the entities:
StringHttpEntity class implements IHttpEntity
ByteArrayHttpEntity class implements IHttpEntity
StreamHttpEntity class implements IHttpEntity

two decorators:
OutgoingEntity class implements and references IHttpEntity
IncomingEntity class implements and references IHttpEntity

The could then be used like:

ice = new IncomingEntity(new StreamHttpEntity(in));
ice.getContentLength()
ice.reset()

oge = new OutgoingEntity(new StreamHttpEntity(in))
oge.isBuffered()
oge.write(out)


Roland Weber wrote:
Hello folks,
as I have briefly mentioned in a previous mail, I would like to
move the handling of HTTP entities into dedicated classes,
instead of having it in method implementations. The main
reasons for this are:
1. entities have to be put into HTTP responses as well, though
   these tend to be more simple than the multipart entities
   frequently found in requests
2. all entity enclosing methods (in particular POST and PUT)
   should provide identical means for defining entities, without
   having to duplicate code
2. on the server side, a method will provide access to the
   enclosed entity but does not allow to define it
In the light of Oleg's attempts to make request and response
objects useful on both client and server side, I believe that
separate entity handling classes will simplify re-use. And
here is my first take on it:
http-common:
  HttpEntity interface
  HttpOutgoingEntity extends HttpEntity (was: RequestEntity)
  HttpIncomingEntity extends HttpEntity
  BasicEntity implements HttpEntity
  BasicOgEntity extends BasicEntity implements HttpOutgoingEntity
  BasicIcEntity extends BasicEntity implements HttpIncomingEntity
  StringOgEntity extends BasicOgEntity
  ByteArrayOgEntity extends BasicOgEntity
  InputStreamOgEntity extends BasicOgEntity
  FormDataOgEntity extends BasicOgEntity
      based on code currently in PostMethod
  OutputStreamIcEntity extends BasicIcEntity
  ByteArrayIcEntity extends BasicIcEntity
  (Rename EntityEnclosingMethod to something that can
   reasonably be implemented by HttpResponse as well?)
http-multipart:
  MultipartOgEntity extends BasicOgEntity
      based on current code in o.a.c.hc.methods.multipart
     (Part, PartBase, StringPart, ByteArrayPart, FilePart
      PartSource, ByteArrayPartSource, FilePartSource)
  MultipartIcEntity extends BasicIcEntity
      based on Commons FileUpload - as a future extension
What do you think? I will take care of updating the
design document once we have reached a consensus.
cheers,
  Roland

-- _________________________________________________________________ NOSE applied intelligence ag

 ortwin gl�ck                      [www]      http://www.nose.ch
 software engineer
 hardturmstrasse 171               [pgp id]           0x81CF3416
 8005 z�rich                       [office]      +41-1-277 57 35
 switzerland                       [fax]         +41-1-277 57 12

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to