cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Claude Moissinac" <moissi...@enst.fr>
Subject Re: Getting a parameter from the header or from a dynamic XML document
Date Sat, 25 Mar 2006 11:27:56 GMT
Thank's; it is a step.
I'm not so familiar with JXPath (but really familiar with XSLT and Xpath)
The sample in http://wiki.apache.org/cocoon/InputModules
{request:cookies[name='lastVisit']/@value}
suggest me to try a similar expression ({request:headers[name='xxx']/@value})
but cookies is an array of cookie objects where headers is an enumerator
I see in the code of the RequestGenerator how this enumerator could be
used, but I can't see how this could be used in an expression like
({request:headers[1]})

I will continue to search the solution, but help is welcome.

On 3/24/06, Lars Huttar <lars_huttar@sil.org> wrote:
> 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: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


--
--
Jean-Claude Moissinac
Department of Computer Science and Networks
ENST Paris
FRANCE

E-mail: moissinac@enst.fr
Tel: (+33) 1.45.81.80.88
Fax: (+33) 1.45.81.71.58

http://shadok.enst.fr/jcm

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


Mime
View raw message