cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roel Croonenberghs <Roel.Croonenber...@sofico.be>
Subject RE: link to a file
Date Fri, 29 Sep 2006 12:23:42 GMT
If I do that, i ge the following error;


Internal Server Error
Message: null
Description: java.lang.NullPointerException
Sender: org.apache.cocoon.servlet.CocoonServlet
Source: Cocoon Servlet
Request URI
download/test.pdf
cause
java.lang.NullPointerException
request-uri
/cocoontest/download/test.pdf
stacktrace
java.lang.NullPointerException
                 at 
org.apache.catalina.connector.ResponseBase.setContentType(ResponseBase.java:874)
                 at 
org.apache.catalina.connector.HttpResponseBase.setContentType(HttpResponseBase.java:853)
                 at 
org.apache.catalina.connector.ResponseFacade.setContentType(ResponseFacade.java:197)
                 at 
org.apache.cocoon.environment.http.HttpResponse.setContentType(HttpResponse.java:214)
                 at 
org.apache.cocoon.environment.http.HttpEnvironment.setContentType(HttpEnvironment.java:216)
                 at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupReader(AbstractProcessingPipeline.java:583)
                 at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.preparePipeline(AbstractProcessingPipeline.java:515)
                 at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:479)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.ReadNode.invoke(ReadNode.java:119)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.invoke(ActTypeNode.java:176)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:165)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163)
                 at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108)
                 at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:152)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:354)
                 at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:307)
                 at org.apache.cocoon.Cocoon.process(Cocoon.java:656)
                 at 
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1112)
                 at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
                 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
                 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                 at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                 at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
                 at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                 at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                 at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                 at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                 at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                 at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1040)
                 at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151)
                 at java.lang.Thread.run(Thread.java:534)

Apache Cocoon 2.1.4-dev




> >2de question; I want the user to download the file, that 
> when teh user 
> >cliks the link, his browser opens a download dialog box so heb can 
> >choose where to save the file.
> >
> >how do I do that?
> 
> To a large extent, that depends on the browser they're using 
> - for example, I have mine set to automatically download 
> files to a specific folder without prompting.
> 
> More generally, though, if the browser has a plugin that can 
> handle the returned mime type it will open it in that; 
> otherwise it will download it. 
> There may also be a separate "download this link" option on 
> the RMB popup menu to allow it to be saved rather than opened.
> If you want to force files to be downloaded rather than 
> handled by plugins, you could return application/octet-stream 
> as the mime type instead of the actual value.

I use the following strategy, which should work for most browsers I
believe:

                 <map:match pattern="download/*">
        <map:act type="set-header">
          <map:parameter name="Content-Type"
value="application/x-download"/>
          <map:parameter name="Content-Disposition" value="attachment ;
filename={1}"/>

          <map:read src="{global:datadir}{1}" />
        </map:act>
                 </map:match>

PS: {global:datadir} refers to a datadir element in
map:pipelines/map:component-configurations/global-variables

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.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



Mime
View raw message