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 whate开发者_C百科ver 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.
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
One possibility is to use MarkupWriter.writeRaw
instead of MarkupWriter.write
in @BeginRender
. Here is a link to the API documentation.
Edit: If you don't want the document to contain anything else except your text content here is one way to achieve this.
@Inject
private Response response
void onActivate() throws IOException {
PrintWriter writer = response.getPrintWriter("text/html");
writer.append("foobar");
writer.close();
}
精彩评论