Thanks Chris.  The intent of this question was to get a start toward streaming 
"pure content" - not just text, but also (and especially PDF), XML, imagery - 
whatever - anything except HTML.  My solution finally was to mimic a previously 
coded button press on an HTML page.  Why?  Because that is where I get all the 
session variables set (search, query etc) to properly construct the PDF 
content.   Then I hid the button and launched the "pure content" page as a 
pagelink, instead, as follows: 

<t:pagelink page="pdf/Index" target="_blank">PDF</t:pagelink>

Rather convoluted, but gets the job done....and, yes, hardly a simpler hello 
world now...(this workaround would be more useful to say "Hello Chris" -  
after, say, selecting from an HTML list of users)



On Tuesday, September 2, 2014 4:27 PM, Chris Mylonas <ch...@opencsta.org> wrote:
 


For future noobs, this is not a simpler hello world, it's making tapestry
respond with text only, no template, nothing but pure text.

I had to do this today and this thread caught my eye last month.

In the standard tapestry 5.3.7 archetype, my Contact.java looks like this.


package org.example.pages;

import org.apache.tapestry5.StreamResponse;
import org.apache.tapestry5.util.TextStreamResponse;

public class Contact {

    StreamResponse onActivate(){
        return new TextStreamResponse("text/plain","some plain old text -
no .tml file, no nothing. plain old text - yay!");
    }
}

I wouldn't describe it as a simpler hello world at all because you're
making tapestry end it's goodness prematurely.  Like learning how to write
a program and the first statement in main() you learn is exit(1);

Reply via email to