cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geert Josten" <geert.jos...@daidalos.nl>
Subject RE: upload:// pseudo protocol
Date Fri, 22 Sep 2006 06:58:57 GMT
For what its worth, I added the following to the sitemap to easily move
uploads to a different location:

  <map:components>
    <map:selectors>
	<!-- redefine request-param-regexp to add 'not-empty' -->
      <map:selector name="request-param-regexp"
src="org.apache.cocoon.selection.RegexpRequestParameterSelector">
        <pattern name="empty">^$</pattern>
        <pattern name="number">^[0-9]+$</pattern>
        <pattern name="string">^.+$</pattern>
        <pattern name="not-empty">^.+$</pattern> 
      </map:selector>
    </map:selectors>

  </map:components>

  <map:resources>
    <map:resource name="save-upload">
      <map:select type="request-param-regexp">
        <map:parameter name="parameter-name" value="{request-param}" />

        <map:when test="not-empty">
          <map:act type="source-action" src="upload://{request-param}">
            <map:parameter name="action" value="copy" />
            <map:parameter name="dest" value="{upload-dir}" />

            <map:generate src="cocoon:/{continue-uri}" />
            <map:serialize type="xml" />

          </map:act>
        </map:when>

        <map:otherwise>
          <map:generate src="cocoon:/{continue-uri}" />
          <map:serialize type="xml" />
        </map:otherwise>
      </map:select>
    </map:resource>
  </map:resources>

And you can call it like this:

        <map:call resource="save-upload">
          <map:parameter name="request-param" value="my-upload" />
          <map:parameter name="upload-dir" value="{global:uploadDir}" />
          <map:parameter name="continue-uri"
value="cocoon://upload-done.html" />
        </map:call>

Kind regards,
Geert

> 
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen,
verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
 

> Van: Steven D. Majewski [mailto:sdm7g@virginia.edu] 
> Verzonden: donderdag 21 september 2006 23:58
> Aan: users@cocoon.apache.org
> Onderwerp: Re: upload:// pseudo protocol
> 
> 
> On Sep 21, 2006, at 4:20 PM, Steven D. Majewski wrote:
> 
> > Is the upload:// pseudo-protocol documented anywhere ?
> > ( I saw it in one of the samples, but could not find 
> anything in the 
> > docs. ) And if it isn't documented: where in the source 
> code should I 
> > look for info on how it's implemented ?
> >
> 
> I just managed to find this myself -- the indirection 
> implicit in cocoon's component model sometimes makes grepping 
> thru the sources a futile search. I see that all of the 
> protocol handlers ( upload as well as file, module, zip, 
> etc... )  are defined in cocoon.xconf :
> 
>      <component-instance
> class="org.apache.cocoon.components.source.impl.PartSourceFactory"  
> name="upload"/>
> 
> 
> Which gives me a start on figuring out how "upload://name" in 
> the sitemap manages to connect up with the MultipartParser.
> 
> 
> >
> > I'm still quite perplexed by all of the various ways of handling 
> > uploading in the cocoon samples, as well as the several methods 
> > documented on the wiki.
> >
> 
> But I'm still preplexed by much of the rest of it!
> 
> 
> -- Steve Majewski
> 
> 
> ---------------------------------------------------------------------
> 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