You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by ru...@us.ibm.com on 2000/07/25 16:41:08 UTC

C2 - casting to HttpEnvironment considered harmful


Perhaps I am just missing the big picture.

Cocoon2 is supposed to work in multiple environments - as a servlet and
from the command line are two examples.  Seeing each of the serializers
casting the environment to HttpEnvironment without so much as a check seem
to me to be a bad thing.

I see at least two ways to address this.

1) Add methods to the Environment interface which do commonly required
functions (like setting the contentType).  Have each environment do the
appropriate thing.  Eliminate the cocoon.Request and cocoon.Response
classes.

2) move the getRequest and getResponse methods from HttpEnvironment to
environment, and change the type they return to be cocoon.Request and
cocoon.Response.

- Sam Ruby

P.S.  The reason I am interested is that I gave a demo last week of Cocoon
and PHP integration - but to make it work I had to make a hack to get the
path names to resolve correctly.  Now I am interested in seeing the right
fix get into the base and I find the system in transition.  I am willing to
make the necessary changes to get the system back up and running, but I
don't want to duplicate anybody's work or evolve the system in the wrong
direction.