Oh, I've always just used <map:read> for everything until now, even with the cocoon:/ protocol--and it's always worked fine. In this case, I realized (after waiting for a server response a really long time and then getting a stack overflow error) that Cocoon was looking for the document specified in the <map:read> by starting at the top matcher. Thus the infinite recursion, since this most general matcher *is* the top (first) matcher.


I just tried <map:redirect-to>, but it doesn't seem to work, although I guess it goes looking only forward (down) in the sitemap since I'm not getting infinite recursion. Once again I can get static html pages just fine but I can't get others. For example this URL fails: http://localhost:8080/showProduct?productId=12345

The error I get is:
message: Sitemap: resource 'cocoon:/showProduct' not found

description:
org.apache.cocoon.ProcessingException: Sitemap: resource 'cocoon:/showProduct' not found: java.lang.NoSuchMethodException: org.apache.cocoon.www.sitemap_xmap.resource_cocoon:/showProduct(org.apache.cocoon.components.pipeline.StreamPipeline, org.apache.cocoon.components.pipeline.EventPipeline, java.util.List, org.apache.cocoon.environment.Environment, java.lang.String, boolean)


The syntax I used is <map:redirect-to resource="cocoon:/{../1}"/>. I didn't want to use the "uri" attribute, since I don't want to send a redirect back to the client (too slow). I also think it needs to be {../1} instead of {1} since it is nested. So here's the new sitemap matcher entry:

<!-- Always check for a valid session first. -->
<map:match pattern="**">
<map:act type="session-isvalid">
<!-- A session exists for this user, so forward to requested URI. -->
<map:redirect-to resource="cocoon:/{../1}"/>
</map:act>


       <!-- No session exists for this user, so create one. -->
       <map:act type="create-session">
         <!-- Kill the session after 4 hours of complete inactivity. -->
         <map:parameter name="max-inactive-interval" value="14400"/>
       </map:act>
       <map:act type="initialize-session"/>
   </map:match>

See anything else wrong?

Btw, do you know if the <map:redirect-to> "session" attribute defaults to "false"? It didn't mention in the Wiki.

From: Mark Leicester <[EMAIL PROTECTED]>

On 13/08/2003 0:44, "Sonny Sukumar" <[EMAIL PROTECTED]> wrote:

>
> Hmm, actually I think it should be <map:read src="cocoon:/{../1}"/>, but
> something strange is happening now...most requests are taking forever and
> then timing out, although simple html pages do load fine still.
>
> What am I missing?


Do you mean <map:read>? See:
http://wiki.cocoondev.org/Wiki.jsp?page=Reader
A reader is usually for static resources such as html files etc.

Or do you want to do an internal <map:redirect-to>? See:
http://wiki.cocoondev.org/Wiki.jsp?page=Redirects

I think this might work:

 <map:match pattern="**">
  <map:act type="session-isvalid">
     <!-- Session exists for user, so forward onto requested URI. -->
     <map:redirect-to uri="cocoon:/{1}"/>
  </map:act>


>
>> From: "Sonny Sukumar" <[EMAIL PROTECTED]>
>>
>> Thanks, Neil. Do you think this would be the best way to do it then?:
>>
>> <map:match pattern="**">
>> <map:act type="session-isvalid">
>> <!-- Session exists for user, so forward onto requested URI. -->
>> <map:read src="cocoon:/{1}"/>
>> </map:act>
>>
>> <!-- No session exists for this user, so create one. -->
>> <map:act type="create-session">
>> <!-- Kill the session after 4 hours of complete inactivity. -->
>> <map:parameter name="max-inactive-interval" value="14400"/>
>> </map:act>
>> <map:act type="initialize-session"/>
>> </map:match>
>>
>> I just added the <map:read src="cocoon:/{1}"/> to break out if the session
>> does indeed exist.
>>
>>> If an action returns a non-null map
>>> (which you'd expect your 1st action to do if the session is valid)
>>> then the nested sitemap content is executed
>>> (in your case there is none - just a comment).
>>>
>>> The sitemap content after the action is executed in any case
>>> (what you were wondering is correct).
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: [EMAIL PROTECTED]
>>> [mailto:[EMAIL PROTECTED]
>>> Behalf Of Sonny Sukumar
>>> Sent: Wednesday, 13 August 2003 8:54 AM
>>> To: [EMAIL PROTECTED]
>>> Subject: session-is-valid
>>>
>>>
>>>
>>> I'm trying to intercept every request and see if a session exists for the
>>> user, creating and initializing a session if one doesn't already exist.
>>> Will this work?:
>>>
>>> <map:match pattern="**">
>>> <map:act type="session-isvalid">
>>> <!-- Session exists for user, so do nothing. -->
>>> </map:act>
>>>
>>> <!-- No session exists for this user, so create one. -->
>>> <map:act type="create-session">
>>> <!-- Kill the session after 4 hours of complete inactivity. -->
>>> <map:parameter name="max-inactive-interval" value="14400"/>
>>> </map:act>
>>> <map:act type="initialize-session"/>
>>> </map:match>
>>>
>>> I'm wondering if Cocoon executes the 2nd and 3rd actions no matter whether
>>> a
>>> session exists or not.
>>>
>>> _________________________________________________________________
>>> Protect your PC - get McAfee.com VirusScan Online
>>> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>
>> _________________________________________________________________
>> Protect your PC - get McAfee.com VirusScan Online
>> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8.
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to