cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carmona Perez, David" <DPerez...@fcc.es>
Subject RE: FileGenerator making two HTTP requests
Date Fri, 13 Feb 2004 10:43:24 GMT
And is there any known workaround?

I have already tried to detect the first request with this action: 

public class RepeatedPdfRequestAction extends AbstractAction {
	/** @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver,
java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters) */
	public Map act(Redirector redirector, SourceResolver resolver, Map objectModel,
		String source, Parameters par) throws Exception 
	{
		Request req = ObjectModelHelper.getRequest(objectModel);
		if (req.getParameter("cocoon-view") != null) {
			return null;
		}
		String agent = req.getHeader("user-agent");
		if (agent != null) {
			if (agent.equals("contype")) {
				getLogger().debug("Peticion IE repe (contype)");
				return EMPTY_MAP;
			} else if (agent.indexOf("MSIE") >= 0 && req.getHeader("accept-language") !=
null) {
				getLogger().debug("Peticion IE repe (accept-language)");
				return EMPTY_MAP;
			}
		}		
		return null;
	}
}


and if the action succeeds, to launch the following reader:

public class EmptyPdfReader extends AbstractReader {
	/**It does nothing 
	 * @see org.apache.cocoon.reading.Reader#generate() */
	public void generate() throws IOException, SAXException, ProcessingException {
		getLogger().debug("Generando PDF vacio");
	}
	/**Returns the mime-type of the resource in process.*/
	public String getMimeType () {
	   return "application/pdf";
	}
}

But sometimes it doesn't work well.

Any suggestions will be welcome!.

--------
David

-----Mensaje original-----
De: Joerg Heinicke [mailto:joerg.heinicke@gmx.de]
Enviado el: viernes, 06 de febrero de 2004 12:37
Para: users@cocoon.apache.org
Asunto: Re: FileGenerator making two HTTP requests

If it is the PDF and you access it via Internet Explorer and the Adobe
Plugin it is an issue of IE. IE requests the file twice.

Joerg

On 04.02.2004 14:44, Teator, Michael wrote:

> Geoff,
>
> The content is returned from a request to a JRun server that returns the
> XML.
>
> I tried setting the pipeline to noncaching, no difference.
>
> I also tried taking JRun out of the equation with a simple test as follows.
> If I try to retrieve http://localhost:8080/cocoon/test5.pdf, I see two
> requests in the localhost access logs for test5.xml.
>
> (note this is just a test sitemap... the XML normally comes from a http
> request to another server, not from cocoon)
>
>               <map:pipeline type="noncaching">
>                       <map:match pattern="test*.xml" type="wildcard">
>                               <map:generate type="file"
> src="tests/test.xml"/>
>                               <map:serialize type="html"/>
>                       </map:match>
>                       <map:match pattern="test*.pdf" type="wildcard">
>                               <map:act type="request">
>                                       <map:parameter name="parameters"
> value="true"/>
>                                       <map:generate type="file"
> src="http://localhost:8080/cocoon/test{../1}.xml"/>
>                                       <map:transform type="xslt-notinc"
> src="tests/test.xsl"/>
>                               </map:act>
>                               <map:serialize type="fo2pdf"/>
>                       </map:match>
>
>                       etc etc...

---------------------------------------------------------------------
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