Search code examples
tapestry

tapestry5 page to render plain text


I've been looking but can't find the the documentation:

Is there a way to have a page render a response without the wrapping HTML elements and just print whatever is provided in the body of the tml or alternatively whatever is set in MarkupWriter.write during @BeginRender?

I need a page that does some server side processing and returns pure javascript for an external application to request.

If that is impossible, is it possible to expose the tapestry Ioc to a servlet in the same app?

Thanks, p.


Solution

  • Sorry ponzao, but i found a better solution courtesy of Thiago on the tapestry mail list:

    public class MyPage
    {
        StreamResponse onActivate()
        {
            return new TextStreamResponse("text/plain", "some text");
        }
    }
    

    this way you don't need to revert to the servlet API and don't need a tml.

    adapted from this eg: http://wiki.apache.org/tapestry/Tapestry5HowToCreateADynamicPDF