Tapestry 5.1 Woodstox

In my last post I suspected the Woodstox lib to be the reason that Tapestry 5.1 does not work on Google App Engine (GAE).

So, I tried to eliminate the Woodstox lib and just use Stax – and it turned out to be really easy. The only problem was that the standard Stax parser does not handle DTDs in a nice way – you have to parse them yourself.

Changes to Tapestry:

  • use XMLInputFactory instead of XMLInputFactory2 in TemplateParserImpl
  • remove inputFactory.configureForSpeed(); in TemplateParserImpl
  • use XMLStreamReader instead of XMLStreamReader2 in StaxTemplateParser
  • change the dtd() method StaxTemplateParser to (this could be nicer):
    private void dtd() throws XMLStreamException
    {
        String dtd = reader.getText();
        String[] dtdElements = dtd.split(" ");
        if(dtdElements.length > 3)
        {
            String rootName = dtdElements[1];
            String publicId = null;
            String systemId = null;
            if("PUBLIC".equals(dtdElements[2]))
            {
                publicId = dtdElements[3];
                if(dtdElements.length > 4)
                    systemId = dtdElements[4];
            }
            else if("SYSTEM".equals(dtdElements[2]))
            {
                systemId = dtdElements[3];
            }
            tokenAccumulator.add(new DTDToken(rootName, publicId, systemId, getLocation()));
        }
    }

I have eliminated Woodstox – Tapestry runs now on plain Stax (included in JRE). But it still does not work on GAE – seems that the whole Stax package is locked and cannot be used. Maybe I give it another try. Hmmm.

Advertisements

One thought on “Tapestry 5.1 Woodstox

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s