You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tino Breddin <s9...@inf.tu-dresden.de> on 2006/01/19 14:11:31 UTC

Problems with the SessionTransformer and

Hi,

well, i accidently hit the send button :-) Here is the full mail.

I want to store some xml data in the user session and later read it. I 
get the following error:

org.apache.cocoon.ProcessingException: SessionManager.streamContextFragment: Context 'navigationcontext' not found.


My approach is like this:

sitemap:

<map:pipeline>
            <map:match pattern="init">
                <map:generate type="jx" src="resources/init.jx"/>
                <map:generate src="resources/navigationitems.xml"/>-->
                <map:transform type="session"/>
                <map:transform src="styles/selectNavItems.xsl"/>
                <map:transform type="session"/>
                <map:redirect-to uri="inittwo"/>
             </map:match>
             <map:match pattern="inittwo">
                <map:generate type="jx" src="resources/init2.jx" />
                <map:transform type="session"/>   <--- the error is 
thrown here
                <map:serialize type="xml"/>    <--- so i can check the 
output at this point
            </map:match>
</map:pipeline>

init.jx:

<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
            xmlns:session="http://apache.org/cocoon/session/1.0">
   
    <root>
        <navigationitems>
            <item>
                <name>name1</name>
                <link>link1</link>
                <roles>
                    <role>role1</role>
                </roles>
            </item>
            <item>
                <name>name2</name>
                <link>link2</link>
                <roles>
                    <role>role2</role>
                </roles>
            </item>
            <item>
                <name>name3</name>
                <link>link3</link>
                <roles>
                    <role>role1</role>
                </roles>
            </item>
            <item>
                <name>name4</name>
                <link>link4</link>
                <roles>
                    <role>role1</role>
                </roles>
            </item>
            <item>
                <name>name5</name>
                <link>link5</link>
                <roles>
                    <role>role1</role>
                    <role>role2</role>
                    <role>role3</role>
                    <role>role4</role>
                    <role>role5</role>
                </roles>
            </item>
        </navigationitems>
        <user>
            <session:getxml context="authentication" 
path="/authentication/roles"/>
        </user>
        <session:createcontext name="navigationcontext"/>
    </root>
</jx:template>

init2.jx:

<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
            xmlns:session="http://apache.org/cocoon/session/1.0">
    <root>
        <session:getxml context="navigationcontext" path="/"/>
    </root>
   
</jx:template>

selectNavItems.xsl:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"    
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                            
xmlns:session="http://apache.org/cocoon/session/1.0">
   
       
    <xsl:template match="root">
        <session:setxml context="navigationcontext" path="/">
            <navigation>
                <xsl:apply-templates select="navigationitems/item"/>   
            </navigation>
        </session:setxml>
    </xsl:template>
   
    <xsl:template match="item">
       
        <xsl:if test="roles/role/node() = /root/user/role/node()">
              <item>
                  <link><xsl:value-of select="link" /></link>
                  <name><xsl:value-of select="name" /></name>
              </item>
          </xsl:if>
    </xsl:template>
</xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with the SessionTransformer and

Posted by Lars Huttar <la...@sil.org>.
On Jan 19, 2006 Tino Breddin wrote:
> Hi Ian,
>
> my fault, i have made a mistake, when i pasted my sitemap fragment 
> into the email. My correct fragment looks like this:
>
> <map:pipeline>
>             <map:match pattern="init">
>                <map:generate type="jx" src="resources/init.jx"/>
>                <map:transform type="session"/>
>                <map:transform src="styles/selectNavItems.xsl"/>
>                <map:transform type="session"/>
>                <map:redirect-to uri="inittwo"/>
>             </map:match>
>             <map:match pattern="inittwo">
>                <map:generate type="jx" src="resources/init2.jx" />
>                <map:transform type="session"/>
>                <map:serialize type="xml"/>
>            </map:match>
> </map:pipeline>
>
>
> Tino
>
This is a very late reply, but I just ran across this after reading 
something that enabled me to see a problem with the above code.
According to 
http://cocoon.apache.org/2.1/userdocs/concepts/redirection.html,
"A redirect must stand alone in a pipeline - it cannot occur after a 
generator. If a redirect needs to be generated conditionally by a 
pipeline, then a <meta> tag redirect should be added into the <head> of 
the HTML page. The syntax for this is..."

Lars

>
>
> ian.d.stewart@jpmchase.com schrieb:
>> Tino,
>>
>> I notice that you have two different <map:generate> elements 
>> (<map:generate
>> type="jx" src="resources/init.jx"/> and <map:generate
>> src="resources/navigationitems.xml"/>) under <map:match pattern="init">.
>> Is that permissable?
>>
>>
>> Ian
>>
>> It's better to be hated for who you are
>> than loved for who you are not
>>
>> Ian D. Stewart
>> Appl Dev Analyst-Advisory, DCS Automation
>> JPMorganChase Global Technology Infrastructure
>> Phone: (614) 244-2564
>> Pager: (888) 260-0078
>>
>>
>>                                                                                                                                        
>>                       Tino 
>> Breddin                                                                                                     
>>                       <s9600916@inf.tu-        To:       
>> users@cocoon.apache.org                                                       
>>                       dresden.de>              
>> cc:                                                                                     
>>                                                Subject:  Problems 
>> with the SessionTransformer and <getxml>                             
>>                       01/19/2006 
>> 08:11                                                                                                 
>>                       
>> AM                                                                                                               
>>                       Please respond 
>> to                                                                                                
>>                       
>> users                                                                                                            
>>                                                                                                                                        
>>
>>
>>
>>
>> Hi,
>>
>> well, i accidently hit the send button :-) Here is the full mail.
>>
>> I want to store some xml data in the user session and later read it. I
>> get the following error:
>>
>> org.apache.cocoon.ProcessingException:
>> SessionManager.streamContextFragment: Context 'navigationcontext' not
>> found.
>>
>>
>> My approach is like this:
>>
>> sitemap:
>>
>> <map:pipeline>
>>             <map:match pattern="init">
>>                 <map:generate type="jx" src="resources/init.jx"/>
>>                 <map:generate src="resources/navigationitems.xml"/>-->
>>                 <map:transform type="session"/>
>>                 <map:transform src="styles/selectNavItems.xsl"/>
>>                 <map:transform type="session"/>
>>                 <map:redirect-to uri="inittwo"/>
>>              </map:match>
>>              <map:match pattern="inittwo">
>>                 <map:generate type="jx" src="resources/init2.jx" />
>>                 <map:transform type="session"/>   <--- the error is
>> thrown here
>>                 <map:serialize type="xml"/>    <--- so i can check the
>> output at this point
>>             </map:match>
>> </map:pipeline>
>>
>> init.jx:
>>
>> <jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
>>             xmlns:session="http://apache.org/cocoon/session/1.0">
>>
>>     <root>
>>         <navigationitems>
>>             <item>
>>                 <name>name1</name>
>>                 <link>link1</link>
>>                 <roles>
>>                     <role>role1</role>
>>                 </roles>
>>             </item>
>>             <item>
>>                 <name>name2</name>
>>                 <link>link2</link>
>>                 <roles>
>>                     <role>role2</role>
>>                 </roles>
>>             </item>
>>             <item>
>>                 <name>name3</name>
>>                 <link>link3</link>
>>                 <roles>
>>                     <role>role1</role>
>>                 </roles>
>>             </item>
>>             <item>
>>                 <name>name4</name>
>>                 <link>link4</link>
>>                 <roles>
>>                     <role>role1</role>
>>                 </roles>
>>             </item>
>>             <item>
>>                 <name>name5</name>
>>                 <link>link5</link>
>>                 <roles>
>>                     <role>role1</role>
>>                     <role>role2</role>
>>                     <role>role3</role>
>>                     <role>role4</role>
>>                     <role>role5</role>
>>                 </roles>
>>             </item>
>>         </navigationitems>
>>         <user>
>>             <session:getxml context="authentication"
>> path="/authentication/roles"/>
>>         </user>
>>         <session:createcontext name="navigationcontext"/>
>>     </root>
>> </jx:template>
>>
>> init2.jx:
>>
>> <jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
>>             xmlns:session="http://apache.org/cocoon/session/1.0">
>>     <root>
>>         <session:getxml context="navigationcontext" path="/"/>
>>     </root>
>>
>> </jx:template>
>>
>> selectNavItems.xsl:
>>
>> <?xml version="1.0" encoding="iso-8859-1"?>
>> <xsl:stylesheet version="1.0"
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>
>> xmlns:session="http://apache.org/cocoon/session/1.0">
>>
>>
>>     <xsl:template match="root">
>>         <session:setxml context="navigationcontext" path="/">
>>             <navigation>
>>                 <xsl:apply-templates select="navigationitems/item"/>
>>             </navigation>
>>         </session:setxml>
>>     </xsl:template>
>>
>>     <xsl:template match="item">
>>
>>         <xsl:if test="roles/role/node() = /root/user/role/node()">
>>               <item>
>>                   <link><xsl:value-of select="link" /></link>
>>                   <name><xsl:value-of select="name" /></name>
>>               </item>
>>           </xsl:if>
>>     </xsl:template>
>> </xsl:stylesheet>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>   
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with the SessionTransformer and

Posted by Tino Breddin <s9...@inf.tu-dresden.de>.
Hi Ian,

my fault, i have made a mistake, when i pasted my sitemap fragment into 
the email. My correct fragment looks like this:

<map:pipeline>
             <map:match pattern="init">
                <map:generate type="jx" src="resources/init.jx"/>
                <map:transform type="session"/>
                <map:transform src="styles/selectNavItems.xsl"/>
                <map:transform type="session"/>
                <map:redirect-to uri="inittwo"/>
             </map:match>
             <map:match pattern="inittwo">
                <map:generate type="jx" src="resources/init2.jx" />
                <map:transform type="session"/>
                <map:serialize type="xml"/>
            </map:match>
</map:pipeline>


Tino



ian.d.stewart@jpmchase.com schrieb:
> Tino,
>
> I notice that you have two different <map:generate> elements (<map:generate
> type="jx" src="resources/init.jx"/> and <map:generate
> src="resources/navigationitems.xml"/>) under <map:match pattern="init">.
> Is that permissable?
>
>
> Ian
>
> It's better to be hated for who you are
> than loved for who you are not
>
> Ian D. Stewart
> Appl Dev Analyst-Advisory, DCS Automation
> JPMorganChase Global Technology Infrastructure
> Phone: (614) 244-2564
> Pager: (888) 260-0078
>
>
>                                                                                                                                        
>                       Tino Breddin                                                                                                     
>                       <s9600916@inf.tu-        To:       users@cocoon.apache.org                                                       
>                       dresden.de>              cc:                                                                                     
>                                                Subject:  Problems with the SessionTransformer and <getxml>                             
>                       01/19/2006 08:11                                                                                                 
>                       AM                                                                                                               
>                       Please respond to                                                                                                
>                       users                                                                                                            
>                                                                                                                                        
>
>
>
>
> Hi,
>
> well, i accidently hit the send button :-) Here is the full mail.
>
> I want to store some xml data in the user session and later read it. I
> get the following error:
>
> org.apache.cocoon.ProcessingException:
> SessionManager.streamContextFragment: Context 'navigationcontext' not
> found.
>
>
> My approach is like this:
>
> sitemap:
>
> <map:pipeline>
>             <map:match pattern="init">
>                 <map:generate type="jx" src="resources/init.jx"/>
>                 <map:generate src="resources/navigationitems.xml"/>-->
>                 <map:transform type="session"/>
>                 <map:transform src="styles/selectNavItems.xsl"/>
>                 <map:transform type="session"/>
>                 <map:redirect-to uri="inittwo"/>
>              </map:match>
>              <map:match pattern="inittwo">
>                 <map:generate type="jx" src="resources/init2.jx" />
>                 <map:transform type="session"/>   <--- the error is
> thrown here
>                 <map:serialize type="xml"/>    <--- so i can check the
> output at this point
>             </map:match>
> </map:pipeline>
>
> init.jx:
>
> <jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
>             xmlns:session="http://apache.org/cocoon/session/1.0">
>
>     <root>
>         <navigationitems>
>             <item>
>                 <name>name1</name>
>                 <link>link1</link>
>                 <roles>
>                     <role>role1</role>
>                 </roles>
>             </item>
>             <item>
>                 <name>name2</name>
>                 <link>link2</link>
>                 <roles>
>                     <role>role2</role>
>                 </roles>
>             </item>
>             <item>
>                 <name>name3</name>
>                 <link>link3</link>
>                 <roles>
>                     <role>role1</role>
>                 </roles>
>             </item>
>             <item>
>                 <name>name4</name>
>                 <link>link4</link>
>                 <roles>
>                     <role>role1</role>
>                 </roles>
>             </item>
>             <item>
>                 <name>name5</name>
>                 <link>link5</link>
>                 <roles>
>                     <role>role1</role>
>                     <role>role2</role>
>                     <role>role3</role>
>                     <role>role4</role>
>                     <role>role5</role>
>                 </roles>
>             </item>
>         </navigationitems>
>         <user>
>             <session:getxml context="authentication"
> path="/authentication/roles"/>
>         </user>
>         <session:createcontext name="navigationcontext"/>
>     </root>
> </jx:template>
>
> init2.jx:
>
> <jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
>             xmlns:session="http://apache.org/cocoon/session/1.0">
>     <root>
>         <session:getxml context="navigationcontext" path="/"/>
>     </root>
>
> </jx:template>
>
> selectNavItems.xsl:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
> xmlns:session="http://apache.org/cocoon/session/1.0">
>
>
>     <xsl:template match="root">
>         <session:setxml context="navigationcontext" path="/">
>             <navigation>
>                 <xsl:apply-templates select="navigationitems/item"/>
>             </navigation>
>         </session:setxml>
>     </xsl:template>
>
>     <xsl:template match="item">
>
>         <xsl:if test="roles/role/node() = /root/user/role/node()">
>               <item>
>                   <link><xsl:value-of select="link" /></link>
>                   <name><xsl:value-of select="name" /></name>
>               </item>
>           </xsl:if>
>     </xsl:template>
> </xsl:stylesheet>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with the SessionTransformer and

Posted by ia...@jpmchase.com.
Tino,

I notice that you have two different <map:generate> elements (<map:generate
type="jx" src="resources/init.jx"/> and <map:generate
src="resources/navigationitems.xml"/>) under <map:match pattern="init">.
Is that permissable?


Ian

It's better to be hated for who you are
than loved for who you are not

Ian D. Stewart
Appl Dev Analyst-Advisory, DCS Automation
JPMorganChase Global Technology Infrastructure
Phone: (614) 244-2564
Pager: (888) 260-0078


                                                                                                                                       
                      Tino Breddin                                                                                                     
                      <s9600916@inf.tu-        To:       users@cocoon.apache.org                                                       
                      dresden.de>              cc:                                                                                     
                                               Subject:  Problems with the SessionTransformer and <getxml>                             
                      01/19/2006 08:11                                                                                                 
                      AM                                                                                                               
                      Please respond to                                                                                                
                      users                                                                                                            
                                                                                                                                       




Hi,

well, i accidently hit the send button :-) Here is the full mail.

I want to store some xml data in the user session and later read it. I
get the following error:

org.apache.cocoon.ProcessingException:
SessionManager.streamContextFragment: Context 'navigationcontext' not
found.


My approach is like this:

sitemap:

<map:pipeline>
            <map:match pattern="init">
                <map:generate type="jx" src="resources/init.jx"/>
                <map:generate src="resources/navigationitems.xml"/>-->
                <map:transform type="session"/>
                <map:transform src="styles/selectNavItems.xsl"/>
                <map:transform type="session"/>
                <map:redirect-to uri="inittwo"/>
             </map:match>
             <map:match pattern="inittwo">
                <map:generate type="jx" src="resources/init2.jx" />
                <map:transform type="session"/>   <--- the error is
thrown here
                <map:serialize type="xml"/>    <--- so i can check the
output at this point
            </map:match>
</map:pipeline>

init.jx:

<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
            xmlns:session="http://apache.org/cocoon/session/1.0">

    <root>
        <navigationitems>
            <item>
                <name>name1</name>
                <link>link1</link>
                <roles>
                    <role>role1</role>
                </roles>
            </item>
            <item>
                <name>name2</name>
                <link>link2</link>
                <roles>
                    <role>role2</role>
                </roles>
            </item>
            <item>
                <name>name3</name>
                <link>link3</link>
                <roles>
                    <role>role1</role>
                </roles>
            </item>
            <item>
                <name>name4</name>
                <link>link4</link>
                <roles>
                    <role>role1</role>
                </roles>
            </item>
            <item>
                <name>name5</name>
                <link>link5</link>
                <roles>
                    <role>role1</role>
                    <role>role2</role>
                    <role>role3</role>
                    <role>role4</role>
                    <role>role5</role>
                </roles>
            </item>
        </navigationitems>
        <user>
            <session:getxml context="authentication"
path="/authentication/roles"/>
        </user>
        <session:createcontext name="navigationcontext"/>
    </root>
</jx:template>

init2.jx:

<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
            xmlns:session="http://apache.org/cocoon/session/1.0">
    <root>
        <session:getxml context="navigationcontext" path="/"/>
    </root>

</jx:template>

selectNavItems.xsl:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:session="http://apache.org/cocoon/session/1.0">


    <xsl:template match="root">
        <session:setxml context="navigationcontext" path="/">
            <navigation>
                <xsl:apply-templates select="navigationitems/item"/>
            </navigation>
        </session:setxml>
    </xsl:template>

    <xsl:template match="item">

        <xsl:if test="roles/role/node() = /root/user/role/node()">
              <item>
                  <link><xsl:value-of select="link" /></link>
                  <name><xsl:value-of select="name" /></name>
              </item>
          </xsl:if>
    </xsl:template>
</xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org