Em Mon, 25 Aug 2008 16:10:11 -0300, immutability <[EMAIL PROTECTED]>
escreveu:
Here's what I'm trying to achieve: I'd like to implement a simplistic
API in our webapplication using just a plain old servlet to handle all
API method calls. The idea is to just call this single servlet, passing
in the required set of parameters via GET/POST, and responding with a
either an XML data
response (text/xml), or a binary stream (zipped data) depending on the
method called.
At least with GET, You could do this with a Tapestry page class returning
a StreamResponse in its onActivate() method. Way easier than writing a
servlet.
More information here:
http://tapestry.apache.org/tapestry5/guide/pagenav.html (StreampResponse
section)
One example here:
http://wiki.apache.org/tapestry/Tapestry5HowToCreatePieChartsInAPage. The
example generates images, but it can be used to generate any kind of
response.
Now, I'm lost trying to find the best way how to mix this into the
existing Tapestry5 application. I have tried to just add the
servlet/mapping into
web.xml but that doesn't work. I thought about extending TapestryFilter
to ignore the API servlet's path, but the doFilter method is "final"
right?
You don't need to do this. Read the "Ignored paths" section of
http://tapestry.formos.com/nightly/tapestry5/guide/conf.html. Short
version: add this method to your AppModule class:
public static void
contributeIgnoredPathsFilter(UnorderedCollection<String> configuration) {
configuration.add("/pathToYourServlet/.*");
}
PS: the configuration page in the regular Tapestry site
(http://tapestry.apache.org/tapestry5/guide/conf.html) is empty.
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]