xsl-list
[Top] [All Lists]

Re: [xsl] Asynchronous transformation in a (Java) Web app

2010-09-12 16:59:23
This article describes something similar:
http://www.devx.com/xml/Article/34677/1763/page/4

So I think I'll just try making my version of XSLTRunnable and use
Executor to run it, and then just start the whole thing directly from
doPost() method in my servlet -- not sure how this part will work out
though...

On Sat, Sep 11, 2010 at 5:08 PM, Andrew Welch 
<andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> wrote:
On 11 September 2010 15:02, Martynas Jusevicius
<martynas(_dot_)jusevicius(_at_)gmail(_dot_)com> wrote:
Hey list,

while asynchronous processing is a broad subject, I hope my question
is not off-topic as it applies directly to XSLT.

The scenario is pretty simple, and I guess not uncommon: user uploads
a (potentially heavy) file, then XSLT transformation(s) process it,
and the result is presented back to the user. The program runs as a
Java Servlet web application.

The problem is, that the transformations can take quite some time, up
to one minute for example. Therefore I started looking into ways of
running them asynchronously, not blocking the servlet and presenting
the result later.
I guess I need some kind of thread-based subsystem to run and
transform in the background, but my knowledge ends pretty much there.

Any advice on approaches/techniques or specific tools/libraries would
be appreciated.

In JAXP, the TransformerFactory and the compiled stylesheet (the
"Templates" object) are both thread safe, but the Transformer is not.
So for each request create a new thread passing in the source, the
TransformerFactory, the Templates object and the response writer, then
create the Transformer in the thread and run the transform (although
its been a while since did any coding at the servlet level...
hopefully that's a point in the right direction).



--
Andrew Welch
http://andrewjwelch.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--