Jean-Claude Moissinac wrote:
I'm trying to get an information from the HTTP header
I have tried with the Request Generator, something like
<map:match pattern="request.xml">
<map:generate type="request">
<map:parameter name="generate-attributes" value="true"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
I get something like
<?xml version="1.0" encoding="ISO-8859-1"?>
<h:request xmlns:h="http://apache.org/cocoon/request/2.0"
target="/filtres/req.svg" sitemap="req.svg" source="">
<h:requestHeaders>
<h:header name="host">localhost:8282</h:header>
<h:header name="user-agent">GPAC 0.4.1-DEV</h:header><h:header
name="accept">*/*</h:header>
<h:header name="terminal">Nokia3650</h:header><h:header
...
And extract the value I need from request.xml. But as I need only one
value from the header, I'm searching another solution. And more, as I
want to give this value as a parameter for an XSL transformation or to
use this value for a selector, extractiong the value from an XML file
is not easy.
I've tried to use request.xml as the source of a XMLFileModule, but it
seems to be not possible to address such a dynamic xml file from the
XMLFileModule.
I heve tried with the Request Module
<map:transform src="text2svg.xsl">
<map:parameter name="terminal" value="{request:terminal}"/>
...
So, I try to use the 'terminal' value present in my request as a
parameter of my transformation. But {request:terminal} seems to be
empty.
See http://wiki.apache.org/cocoon/InputModules for documentation on
RequestModule's properties. Rather than {request:terminal}, you might
try {request:headers}, which "returns all the values of the specified
request header as an Enumeration of String objects." Then maybe you
could use JXPath to select the one you want?
So, I'm searching a good way to extract a value from the header or to
use a value extracted from a dynamically created xml document as a
parameter for a pipeline.
What about the HeaderAttributeModule?
(http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html)
I have not used it, but it looks like it has potential. Are "header
attributes" the same as what we call headers (like "terminal")?
HTH,
Lars
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]