cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorg Heymans ...@domek.be>
Subject Re: different upload-dirs for different applications
Date Tue, 30 Sep 2003 11:41:16 GMT
did you have a look at core.log in WEB-INF/logs, often the error can be 
found less cryptical in there

mind that in your case, the action should always return a Map, not null 
otherwise the rest of the action will be skipped, resulting in an 
incomplete pipeline.

erhm, could you maybe also try

    <map:act type="upload-files">
	    <map:generate src="new-samples/success.html" type="html"/>
	    <map:serialize type="html"/>
    </map:act>

which version of cocoon are you using?

rgds
jorg

blick@fmi.uni-passau.de wrote:

>hi,
>
>i did the changes you purposed (changing the sitemap and/or returning
>null)but it had no effect. the upload class still get's called, but i also
>still get the same exception.
>
>the thing i want to have is: i upload the file and then cocoon sends me to
>some other site -- static or dynamic i don't mind.
>
>best regards!
>
>peter
>
>ps: still bad quoting. sorry.
>
>-------------------------------------------------------
>
>Original Message:
>-----------------
>From: Jorg Heymans jh@domek.be
>Date: Tue, 30 Sep 2003 12:46:27 +0200
>To: users@cocoon.apache.org
>Subject: Re: different upload-dirs for different applications
>
>
>did you try to move the generator and reader within the action itself ? 
>your sitemap syntax seems a bit strange
>
>    <map:act type="upload-files"/>
>    <map:generate type="request">
>    <map:read src="new-samples/success.html" mime-type="text/html"/>
>    </map:generate>
>
>should be
>
>    <map:act type="upload-files">
>	    <map:generate type="request">
>	    <map:read src="new-samples/success.html" mime-type="text/html"/>
>    </map:act>
>
>when your returning a map at the end of your action then the rest of the 
>pipeline inside the map will get executed, return null if this is not 
>desired.
>
>Hope this helps
>Jorg
>
>blick@fmi.uni-passau.de wrote:
>
>  
>
>>first -- pleast excuse my bad quoting. mail2web does not support better. :(
>>
>>i'm still getting crazy trying to upload files into different directorys. i
>>did the solution as offered in the answer below. i inserted the example
>>into the standard cocoon configuration (retrieved from cocoon.war).
>>
>>perhaps 1st the code.
>>
>>--[sitemap.xmap begin]----
>>
>><map:actions>
>>  <map:action logger="sitemap.action.request" name="upload-files"
>>src="de.my.cocoon.UploadSplitter"/>
>>..
>></map:action>
>>
>><map:pipeline>
>> <map:match pattern="upload">
>>   <map:generate src="new-samples/fileUp.xhtml"/>
>>   <map:serialize type="xhtml"/>
>> </map:match>
>>
>> <map:match pattern="uploadFileFromUser">
>>   <map:act type="upload-files"/>
>>   <map:generate type="request">
>>   <map:read src="new-samples/success.html" mime-type="text/html"/>
>>   </map:generate>
>> </map:match>
>>
>> <map:match pattern="**/uploadFileFromUser">
>>   <map:act type="upload-files"/>
>>   <map:generate type="request">
>>   <map:read src="new-samples/success.html" mime-type="text/html"/>
>>   </map:generate>
>> </map:match>
>>...
>></map:pipeline>
>>-----[end of sitemap.xmap]--------------------------------------
>>
>>i also changed the needed entrys in web.xml.
>>
>>the "class de.my.cocoon.uploadSplitter" is quite the same than the example
>>given on wiki (and below). it works, it produces anoter file every time i
>>upload something. (i do not save the uploaded file yet.)
>>
>>problem is: i still get this error after uploading the file:
>>
>>"Resource not found
>>No pipeline matched request: uploadFileFromUser
>>
>>org.apache.cocoon.ResourceNotFoundException: No pipeline matched request:
>>uploadFileFromUser"
>>
>>and the following stacktrace [just first 3 lines..]
>>
>>org.apache.cocoon.ResourceNotFoundException: No pipeline matched request:
>>uploadFileFromUser
>>
>>	at
>>org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(Pipe
>>    
>>
>l
>  
>
>>ineNode.java:168)
>>
>>	at
>>org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.inv
>>    
>>
>o
>  
>
>>keNodes(AbstractParentProcessingNode.java:108)
>>
>>
>>.. 
>>
>>anyone can help me with a slightly longer explaination or a resource where
>>i can read (and understand it)?
>>
>>best regards and thanks a lot!
>>
>>peter
>>
>>
>>
>>
>>
>>--[old mails]----------------------------------------------------------
>>you need to create an action that has some logic in it which determines 
>>the application trying to save the file (eg make the applications pass a 
>>unique parameter in the request or so)
>>
>>>From the wiki 
>>(http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadWithAction)
>>
>>   public Map act(Redirector redirector, SourceResolver resolver,
>>                  Map objectModel, String source, Parameters par)
>>       throws Exception
>>   {
>>	//use the request object below to get the additional request parameter
>>       Request request = ObjectModelHelper.getRequest(objectModel);
>>       FilePart filePart = (FilePart) request.get("uploaded_file");
>>
>>       File file = ((FilePartFile)filePart).getFile();	
>>       getLogger().debug("Uploaded file = " + file.getCanonicalPath());
>>       // here you can open an InputStream on the file or whatever
>>       // you may also want to delete the file after using it
>>       return Collections.EMPTY_MAP;
>>
>>   }
>>
>>action can be defined in the sitemap as following
>>   <map:actions>
>>     <map:action name="upload-files" src="your.action.package.class"
>>                         logger="my.logger.filestore"/>
>>   </map:actions>     
>>
>><map:pipelines>
>>......
>>       <map:act type="upload-files">
>>             <map:generate type="request"/>
>>       </map:act>
>>
>>
>>blick@fmi.uni-passau.de wrote:
>>
>> 
>>
>>    
>>
>>>Hi,
>>>
>>>I have 2 applications accessing one cocoon (using different paths of
>>>course). Both apps need to upload Files. Is there any way to make cocoon
>>>save the incoming files in different directorys?
>>>
>>>I have seen the single-Directory solution but that does not fit my needs. 
>>>
>>>Any help is highly appreciated!
>>>
>>>peter
>>>
>>>
>>>   
>>>
>>>      
>>>
>>--------------------------------------------------------------------
>>mail2web - Check your email from the web at
>>http://mail2web.com/ .
>>
>>
>>
>>---------------------------------------------------------------------
>>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
>
>
>
>--------------------------------------------------------------------
>mail2web - Check your email from the web at
>http://mail2web.com/ .
>
>
>
>---------------------------------------------------------------------
>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