cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers" <robby.pelss...@ciber.com>
Subject RE: Problem handling invalid continuation exception
Date Mon, 22 Feb 2010 19:27:22 GMT
Yes... I did.

Below you will find the relevant sitemap snippets.

<?xml version="1.0" encoding="UTF-8"?>

<map:sitemap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://apache.org/cocoon/sitemap/1.0 http://cocoon.apache.org/schema/sitemap/cocoon-sitemap-1.0.xsd"
 xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <map:flow language="javascript"/>

  <map:pipelines>
  
    <map:pipeline id="webapp">
      <map:match pattern="">
        <map:generate src="cocoon:/index.html"/>
        <map:serialize type="xhtml"/>
      </map:match>
      
      <map:match pattern="index.html">
        <map:call function="main" />
      </map:match>
      
      <map:match pattern="index.jx">
        <map:generate src="page/index.jx" type="jx" />   
        <map:serialize type="xhtml" />
      </map:match>

      <map:match pattern="*.continue">
        <map:call continuation="{1}"/>
      </map:match>
        
       
      <map:match pattern="selector/*">
        <map:generate src="page/selector/{1}" type="jx" /> 
        <map:transform type="browser-update"/>
		<map:transform src="resource/internal/xslt/forms-samples-styling.xsl">
		  <map:parameter name="dojo-resources" value="{servlet:ajax:/resource/external/dojo}"/>
		  <map:parameter name="forms-resources" value="{servlet:forms:/resource/external/forms}"/>
		</map:transform>
        <map:transform type="servletLinkRewriter"/>	
		<map:select type="ajax-request">
		  <map:when test="true">
		    <map:serialize type="xml"/>
		  </map:when>
		  <map:otherwise>
		    <map:serialize type="html"/>
		  </map:otherwise>
		</map:select>
      </map:match> 
       
	    <!-- the new non-hardcoded way of handling invalidContinuation -->
	    <map:handle-errors>
	      <map:select type="exception">
	        <map:when test="invalid-continuation">
              <map:generate src="cocoon:/index.html"/>
              <map:serialize type="xhtml"/>
	        </map:when>
	      </map:select>
	    </map:handle-errors>
       
            
     </map:pipeline>    

    <!--+
        | Default pipelines
        +-->
    <map:pipeline id="internal-resource" internal-only="true">
      <map:match pattern="resource/internal/**">
        <map:read src="resource/internal/{1}"/>
      </map:match>
    </map:pipeline>

    <map:pipeline id="external-resource">
      <map:match pattern="resource/external/**">
        <map:read src="resource/external/{1}"/>
      </map:match>
    </map:pipeline>

    <map:pipeline id="service">
    </map:pipeline>
  </map:pipelines>
  
	<map:components>
	  <map:serializers>        
       <map:serializer logger="sitemap.serializer.xml" mime-type="text/xml" name="xml"
src="org.apache.cocoon.serialization.XMLSerializer">
          <encoding>UTF-8</encoding>
       </map:serializer>
	  </map:serializers>
      <map:transformers>
        <map:transformer name="saxon" src="org.apache.cocoon.transformation.TraxTransformer">
 
          <xslt-processor-role>saxon</xslt-processor-role>
        </map:transformer>
        <map:transformer name="browser-update" src="org.apache.cocoon.ajax.BrowserUpdateTransformer"/>
	      
      </map:transformers>
      <map:selectors>
        <map:selector name="ajax-request" src="org.apache.cocoon.ajax.AjaxRequestSelector"/>
      </map:selectors>
	</map:components>    

</map:sitemap>

-----Original Message-----
From: Tomek Piechowicz [mailto:tomasz.piechowicz@gmail.com] 
Sent: Monday, February 22, 2010 8:15 PM
To: users@cocoon.apache.org
Subject: Re: Problem handling invalid continuation exception

Hi,
I removed extra slash and set serialization type to xhtml but it didn`t 
help. Do you use ajax in your form ?

Regards,
Tomek Piechowicz

Robby Pelssers pisze:
> Comparing your solution to mine 
>
> 	    <!-- the new non-hardcoded way of handling invalidContinuation -->
> 	    <map:handle-errors>
> 	      <map:select type="exception">
> 	        <map:when test="invalid-continuation">
>               <map:generate src="cocoon:/index.html"/>
>               <map:serialize type="xhtml"/>
> 	        </map:when>
> 	      </map:select>
> 	    </map:handle-errors>
>
> Shows only a few differences:
> - you serialize to xml instead of xhtml 
> - I use only one slash '/' for calling the cocoon protocol
>
> Robby
>
> -----Original Message-----
> From: Tomek Piechowicz [mailto:tomasz.piechowicz@gmail.com] 
> Sent: Monday, February 22, 2010 7:40 PM
> To: users@cocoon.apache.org
> Subject: Problem handling invalid continuation exception 
>
> Hi.
> I have simple CForm (C2.2) with ajax repeater, and I am trying to handle 
> invalid continuation error. I have already added handler to my 
> sitemap.xmap :
>
> <map:pipeline>
>           <map:match pattern="lectures-*.continue">
>               <map:call continuation="{1}"/>
>           </map:match>
>          
>          
>         <map:handle-errors>
>           <map:select type="exception">
>             <map:when test="invalid-continuation">
>                 <map:generate src="cocoon://admin-lectures" />
>                 <map:serialize />
>             </map:when>
>           </map:select>
>           </map:handle-errors>
>          
>       </map:pipeline>
>
> Generally I would like to redirect user to page (admin-lectures) but I 
> know it is not possible to use map:redirect-to in sitemap error handler 
> (why ?), so I tried to generate page with cocoon protocol but it also 
> doesn`t work. The problem is that when user submits form and then hit 
> back button in browser and tries submit form again - instead of redirect 
> I got javascript alert : "No response data found. Show server response 
> ?". I see no exception in jetty console - so it is probably handled by 
> sitemap.
>
> Can any one give me some tips how to perform page redirect in sitemap 
> error handler ?
>
> Regards,
> Tomek Piechowicz
>
> ---------------------------------------------------------------------
> 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

Mime
View raw message