You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by "Thorsten Scherler (JIRA)" <ji...@apache.org> on 2008/09/30 09:45:44 UTC

[jira] Created: (FOR-1118) Dispatcher 1.0 - towards a stable version

Dispatcher 1.0 - towards a stable version
-----------------------------------------

                 Key: FOR-1118
                 URL: https://issues.apache.org/jira/browse/FOR-1118
             Project: Forrest
          Issue Type: Improvement
          Components: Plugin: internal.dispatcher
            Reporter: Thorsten Scherler


The current version of the dispatcher has some points for enhancement this issue is to keep track of the changes.

The work is conducted in https://svn.apache.org/repos/asf/forrest/branches/dispatcher_rewrite which is based on trunk r700363 forrest/whiteboard.

The thread "Dispatcher 1.0 - towards a stable version"
http://markmail.org/message/nm6etnhg4nuhm2kl has pointed out:
- performance issues due to DOM usage in the current implementation and code readability 
--> 1.0 will provide two implementations pure StAX and AXIOM (OM StAX) 
--> 1.0 will provide a cocoon transformer that can use either one of the
above implementation 
- documentation 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (FOR-1118) Dispatcher 1.0 - towards a stable version

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Wed, 2008-10-01 at 13:52 +0200, Thorsten Scherler wrote:
> On Wed, 2008-10-01 at 07:28 -0400, Tim Williams wrote:
> > On Wed, Oct 1, 2008 at 7:12 AM, Thorsten Scherler
> > <th...@juntadeandalucia.es> wrote:
> > > On Wed, 2008-10-01 at 04:09 -0700, Thorsten Scherler (JIRA) wrote:
> > >> [ https://issues.apache.org/jira/browse/FOR-1118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636000#action_12636000 ]
> > > ...
> > >>
> > >> At the first look that seems to be the same but one important change is:
> > >> <forrest:content xmlns:forrest="http://apache.org/forrest/templates/2.0">
> > >> in the cocooon env we are eating the xmlns.
> > >>
> > >> That is really weird since the code supposed to use the same time the same stax implementation (woodstox).
> > >
> > > somebody has an idea why that is happening?
> > 
> > Not really, but have you tried to output the actual implementation
> > class name for the TransformerFactory to see if you might be getting
> > different implementations in each runtime environment?
> 
> Actually in this stage there is no transformer involved but 
> inputFactory = XMLInputFactory.newInstance();
> outputFactory = XMLOutputFactory.newInstance();
> eventFactory = XMLEventFactory.newInstance();
> 
> but I will see whether they are the same. 

writer	WstxEventWriter  (id=51)	
	mWriter	SimpleNsStreamWriter  (id=87)	
	mWstxWriter	SimpleNsStreamWriter  (id=87)	

allocator	DefaultEventAllocator  (id=33)	

reader	ValidatingStreamReader  (id=59)	

there is no obvious difference.

:(

salu2


> Cheers Tim.
> 
> salu2
> > 
> > --tim
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: [jira] Commented: (FOR-1118) Dispatcher 1.0 - towards a stable version

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Wed, 2008-10-01 at 07:28 -0400, Tim Williams wrote:
> On Wed, Oct 1, 2008 at 7:12 AM, Thorsten Scherler
> <th...@juntadeandalucia.es> wrote:
> > On Wed, 2008-10-01 at 04:09 -0700, Thorsten Scherler (JIRA) wrote:
> >> [ https://issues.apache.org/jira/browse/FOR-1118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636000#action_12636000 ]
> > ...
> >>
> >> At the first look that seems to be the same but one important change is:
> >> <forrest:content xmlns:forrest="http://apache.org/forrest/templates/2.0">
> >> in the cocooon env we are eating the xmlns.
> >>
> >> That is really weird since the code supposed to use the same time the same stax implementation (woodstox).
> >
> > somebody has an idea why that is happening?
> 
> Not really, but have you tried to output the actual implementation
> class name for the TransformerFactory to see if you might be getting
> different implementations in each runtime environment?

Actually in this stage there is no transformer involved but 
inputFactory = XMLInputFactory.newInstance();
outputFactory = XMLOutputFactory.newInstance();
eventFactory = XMLEventFactory.newInstance();

but I will see whether they are the same. 

Cheers Tim.

salu2
> 
> --tim
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: [jira] Commented: (FOR-1118) Dispatcher 1.0 - towards a stable version

Posted by Tim Williams <wi...@gmail.com>.
On Wed, Oct 1, 2008 at 7:12 AM, Thorsten Scherler
<th...@juntadeandalucia.es> wrote:
> On Wed, 2008-10-01 at 04:09 -0700, Thorsten Scherler (JIRA) wrote:
>> [ https://issues.apache.org/jira/browse/FOR-1118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636000#action_12636000 ]
> ...
>>
>> At the first look that seems to be the same but one important change is:
>> <forrest:content xmlns:forrest="http://apache.org/forrest/templates/2.0">
>> in the cocooon env we are eating the xmlns.
>>
>> That is really weird since the code supposed to use the same time the same stax implementation (woodstox).
>
> somebody has an idea why that is happening?

Not really, but have you tried to output the actual implementation
class name for the TransformerFactory to see if you might be getting
different implementations in each runtime environment?

--tim

Re: [jira] Commented: (FOR-1118) Dispatcher 1.0 - towards a stable version

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Wed, 2008-10-01 at 13:12 +0200, Thorsten Scherler wrote:
> On Wed, 2008-10-01 at 04:09 -0700, Thorsten Scherler (JIRA) wrote:
> > [ https://issues.apache.org/jira/browse/FOR-1118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636000#action_12636000 ] 
> ...
> > 
> > At the first look that seems to be the same but one important change is:
> > <forrest:content xmlns:forrest="http://apache.org/forrest/templates/2.0">
> > in the cocooon env we are eating the xmlns.
> > 
> > That is really weird since the code supposed to use the same time the same stax implementation (woodstox).
> 
> somebody has an idea why that is happening?

ARGH!

It is the cocoon serializer. It seems to be a feature that it only
declares once the xmlns. Preferable in the root element. Meaning the
stax is not eating the xmlns but cocoon is. 

See it if you request http://localhost:8888/resolve.contracts and look
at the source code. Bummer. 

...now to find a fix for this.

salu2

> 
> salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


Re: [jira] Commented: (FOR-1118) Dispatcher 1.0 - towards a stable version

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Wed, 2008-10-01 at 04:09 -0700, Thorsten Scherler (JIRA) wrote:
> [ https://issues.apache.org/jira/browse/FOR-1118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636000#action_12636000 ] 
...
> 
> At the first look that seems to be the same but one important change is:
> <forrest:content xmlns:forrest="http://apache.org/forrest/templates/2.0">
> in the cocooon env we are eating the xmlns.
> 
> That is really weird since the code supposed to use the same time the same stax implementation (woodstox).

somebody has an idea why that is happening?

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


[jira] Commented: (FOR-1118) Dispatcher 1.0 - towards a stable version

Posted by "Thorsten Scherler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FOR-1118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636000#action_12636000 ] 

Thorsten Scherler commented on FOR-1118:
----------------------------------------

Using the StAX implementation of the contract is different for junit in eclipse and within forrest.

To test with forrest do the following:
# preparation of forrest
cd $FORREST_HOME/whiteboard 
svn switch https://svn.apache.org/repos/asf/forrest/branches/dispatcher_rewrite
# create a new test seed
cd $TEST_HOME
forrest seed
mv forrest.properties.dispatcher.properties forrest.properties
cd src/documentation/
cp $FORREST_HOME/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/m2.contract.xml .
cp $FORREST_HOME/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/master.structurer.xml .
vi sitemap.xmap
# add the following as child of map:components
<map:transformers>
      <map:transformer name="dispatcher"
        src="org.apache.forrest.dispatcher.transformation.DispatcherTransformer">
        <!--+
        |  If you want to use inline xml for contract properties be aware that setting 
        | this properties to true will have negative influence on performance since 
        | this feature needs to use DOM parsing!
        |
        | We strongly recommend to rewrite your contracts and structurer to use simple 
        | string for the properties.
        |   
        | The default is set to "false".
        +-->
        <!--<allowXml>true</allowXml>-->
        
        <!--+
        |  If you want to change the uri prefix of the contracts. 
        | This may be interesting if you work with a contract repository rather then
        | with the ones from the themer plugin. 
        |  
        | The default is "cocoon://resolve.contract".
        +-->
        <!--<contractUriPrefix>cocoon://resolve.contract</contractUriPrefix>-->
        
        <!--+
        |  You can use either limited of full xpath support for the injection of contract 
        | result data. We currently provide the basic support with a plain StAX implementation
        | and the enhanced support with AXIOM.
        |  
        | The default is "basic".
        +-->
        <!--<xpathSupport>enhanced</xpathSupport>-->
      </map:transformer>
    </map:transformers>

# and the following as child of map:pipeline
    <map:match pattern="test">
      <map:generate src="master.structurer.xml"/>
      <map:transform type="dispatcher">
        <map:parameter name="request" value="{0}" />
        <map:parameter name="type" value="html" />
      </map:transform>
      <map:serialize type="xml"/>
    </map:match>
    <map:match pattern="resolve.contract*">
      <map:generate src="m2.contract.xml"/>
      <map:serialize type="xml"/>
    </map:match>

As you see we are using the exact same files as in junit testing, however the result is not the same.

If you now start your $TEXT_HOME with forrest run and request http://localhost:8888/test you will get an error.

The command line will tell you:
"SystemId Unknown; Line #4; Column #85; xsl:param is not allowed in this position in the stylesheet!
[Fatal Error] :6:26: The prefix "forrest" for element "forrest:content" is not bound.
SystemId Unknown; Line #6; Column #26; org.xml.sax.SAXParseException: The prefix "forrest" for element "forrest:content" is not bound."

In junit all tests of both TestStructurer and TestContract are running fine and do not present the above error.

I tracked down the problem to XSLContractHelper#processTemplate(XMLStreamReader reader). Here is an important difference between the junit and cocoon test. 

If you change in the above method the following
+  System.out.println(out.toString());
-   log.debug(out.toString());

You will see for JUNIT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:param name="test-inline" select="'No parameter has been passed'" />
      <xsl:param name="test-inline-xml" select="'No xml parameter has been passed'" />
      <xsl:template match="/">
        <forrest:content xmlns:forrest="http://apache.org/forrest/templates/2.0">
          <forrest:part>
            Another test! $test-inline:
            <xsl:value-of select="$test-inline" />
            $test-inline-xml:
            <xsl:copy-of select="$test-inline-xml" />
          </forrest:part>
          <forrest:part xpath="/html/head">
            <meta content="m2 - another test" name="Description" />
          </forrest:part>
        </forrest:content>
      </xsl:template>
    </xsl:stylesheet>

and in FORREST
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:param name="test-inline" select="'No parameter has been passed'" />
      <xsl:param name="test-inline-xml" select="'No xml parameter has been passed'" />
      <xsl:template match="/">
        <forrest:content>
          <forrest:part>
            Another test! $test-inline:
            <xsl:value-of select="$test-inline" />
            $test-inline-xml:
            <xsl:copy-of select="$test-inline-xml" />
          </forrest:part>
          <forrest:part xpath="/html/head">
            <meta content="m2 - another test" name="Description" />
          </forrest:part>
        </forrest:content>
      </xsl:template>
    </xsl:stylesheet>

At the first look that seems to be the same but one important change is:
<forrest:content xmlns:forrest="http://apache.org/forrest/templates/2.0">
in the cocooon env we are eating the xmlns.

That is really weird since the code supposed to use the same time the same stax implementation (woodstox).

> Dispatcher 1.0 - towards a stable version
> -----------------------------------------
>
>                 Key: FOR-1118
>                 URL: https://issues.apache.org/jira/browse/FOR-1118
>             Project: Forrest
>          Issue Type: Improvement
>          Components: Plugin: internal.dispatcher
>            Reporter: Thorsten Scherler
>
> The current version of the dispatcher has some points for enhancement this issue is to keep track of the changes.
> The work is conducted in https://svn.apache.org/repos/asf/forrest/branches/dispatcher_rewrite which is based on trunk r700363 forrest/whiteboard.
> The thread "Dispatcher 1.0 - towards a stable version"
> http://markmail.org/message/nm6etnhg4nuhm2kl has pointed out:
> - performance issues due to DOM usage in the current implementation and code readability 
> --> 1.0 will provide two implementations pure StAX and AXIOM (OM StAX) 
> --> 1.0 will provide a cocoon transformer that can use either one of the
> above implementation 
> - documentation 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.