> Yes it is possible - and in fact I want to do exactly this too. The plan
> I have is to have a special Screen subclass (FlashScreen) from which all
> my screen classes that need to generate text for flash get derived. Then
> I derive from DefaultPage and check to see if the screen is a
> FlashScreen - if it is then the screen is invoked directly bypassing
> layouts/navigations, otherwise the superclass stuff gets invoked (all
> the HTML preparation).

I've had a closer look on how the core Turbine servlet works, and it
seems that the all is there :-). The Turbine engine look in the RunData
for 2 methods isPageSet() and isOutSet(). If the user has called
getOut() in its Screen, isPageSet() is set to false, and outSet is set
to true, and the layout output is ignored. If, screen.getLayout()
returns null, the Layout stuff is not executed (by the DefaultPage), and
outSet remains false. So, there is no work needed in the core :-)

Anyway, the RunData.getOut() method returns a PrintWriter which is
unusable for writing raw binary data. On top of that, the mechanism for
writing Screens for arbitrary type is not intuitive today. So I want to:

1 - add two methods to RunData
      * javax.servlet.ServletOutputStream getOutputStream()
      * java.io.PrintWriter getWriter()
    the second one just make a call to getOut() and is there for naming
consistancy (getOut() may be deprecated while it is ambiguous.)

2 - create a new base Screen (in modules.screens)

public abstract class RawScreen extends Screen
{
   protected ConcreteElement doBuild(RunData data);
   protected abstract void doOutput(RunData data);
   public final void getLayout(); //returns null
}

To create Screens that returns aribitrary content type, one should
create a class that extends RawScreen and implement the doOutput method,
for example:

void doOutput(Rundata data)
{
   data.setContentType("text/plain");
   PrintWriter out = data.getWriter();
   out.println("Hello World !");
}

thoughts ?

Regis


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to