cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sonny Sukumar" <>
Subject Re: map:redirect-to...
Date Thu, 29 Jul 2004 22:47:22 GMT

Hey John,

Thanks for the advice.  I didn't get it to work, but I *did* spend a few 
hours on it and discovered something interesting.  Here's the steps I 

1.) I first introduced new internal redirects, commenting out the old ones:

<map:match pattern="secure/doTest">
  <map:act type="perform-test">
    <!-- Test succeeded. -->
    <!--map:redirect-to uri="cocoon:/showTestSucceededPage"/-->
    <map:redirect-to uri="cocoon:/myTestSucceeded"/>

  <!-- Test failed. -->
  <!--map:redirect-to uri="cocoon:/showTestFailedPage"/-->
  <map:redirect-to uri="cocoon:/myTestFailed"/>

This actually works on the first request but not after that!  (Yes, I'm 
resetting the state of my db after each request so I can test this Cocoon 
stuff independently of that state.)

BTW, the new redirects go to extremely basic straight HTML pages for which 
the code is like 3 lines (<html><head><title>...</title></head>
Text</body></html>), and these simple pages are fetched with a simple 
<map:read mime-type="html" src="..."/>)

2.) So I comment out the new redirects, uncomment the old redirects, and try 
1 more request:

<map:match pattern="secure/doTest">
  <map:act type="perform-test">
    <!-- Test succeeded. -->
    <map:redirect-to uri="cocoon:/showTestSucceededPage"/>
    <!--map:redirect-to uri="cocoon:/myTestSucceeded"/-->

  <!-- Test failed. -->
  <map:redirect-to uri="cocoon:/showTestFailedPage"/>
  <!--map:redirect-to uri="cocoon:/myTestFailed"/-->

This request doesn't work (shows "test failed" instead of "test succeeded"), 
though I didn't really expect it to.

3.) So now I go back to how it was in Step 1--and then it works!  BUT only 
the FIRST time!

And I can repeat the above behavior over and over, getting it to work but 
only once.  So it seems like it might have something to do with pipeline 
setup or something...I just don't know.

BTW, simply reuploading the sitemap after Step 1 doesn't get it to work 
either.  I actually have to go through the 3 steps exactly as I mentioned.

Hopefully this sparks some insight?  I sure hope one of us can figure it 
out...this scenario can happen to anyone!



>From: "John L. Webber" <>
>Subject: Re: map:redirect-to...
>Date: Thu, 29 Jul 2004 09:18:43 +0200
>Hi Sonny,
>The only other thing I can suggest trying is to reproduce the bug with an 
>alternate matcher, using different redirect resources and a different 
>action. If the bug doesn't happen then, try swapping in your actual 
>resources one at a time, and then your action. Something like:
><map:match pattern="secure/reallySimpleTest">
>   <map:act type="always-succeeds">
>     <map:redirect-to uri="cocoon:/pageExists1"/>
>   </map:act>
>   <map:redirect-to uri="cocoon:/pageExists2"/>
>If that works as expected (i.e. no bug), try replacing the first redirect 
>with your actual redirect. Of course, you'll have to create the new 
>resources first!
>Good luck,
>Sonny Sukumar wrote:
>>Hey John,
>>I took your advice and spent some time culling through sitemap.log and 
>>discovered that BOTH redirects are taking place when I use internal 
>>'s just that the "test failed" redirect happens second, so I 
>>always see that result page (even though the action's operations in 
>>modifying the database, etc. are performed successfully).
>>Why this happens is still a mystery to me, but here's the sitemap log info 
>>showing this:
>>INFO    (2004-07-28) 10:47.42:387   [sitemap] (/secure/doTest) 
>>http8443-Processor2/RedirectToURINode: Redirecting to 
>>'cocoon:/showTestSucceededPage' at 
>>INFO    (2004-07-28) 10:47.42:388   [sitemap] (/secure/doTest) 
>>http8443-Processor2/ForwardRedirector: Redirecting to 
>>INFO    (2004-07-28) 10:47.42:711   [sitemap] (/secure/doTest) 
>>http8443-Processor2/RedirectToURINode: Redirecting to 
>>'cocoon:/showTestFailedPage' at 
>>INFO    (2004-07-28) 10:47.42:712   [sitemap] (/secure/doTest) 
>>http8443-Processor2/ForwardRedirector: Redirecting to 
>>So I then tried--just for the heck of it--putting an html serializer right 
>>after the first redirect like this:
>><map:match pattern="secure/doTest">
>>  <map:act type="perform-test">
>>    <!-- Test succeeded. -->
>>    <map:redirect-to uri="cocoon:/showTestSucceededPage"/>
>>    <map:serialize type="html"/>
>>  </map:act>
>>  <!-- Test failed. -->
>>  <map:redirect-to uri="cocoon:/showTestFailedPage"/>
>>And of course that didn't work either. :-)  Sooo...maybe there's a bug 
>>with internal redirects?
>>BTW, I'm using the absolute latest stable version of Cocoon ( on 
>>Tomcat 4.1.30.  I upgraded just a few days ago...
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Express yourself instantly with MSN Messenger! Download today - it's FREE!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message