You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Nicolas LE BAS <ma...@nlebas.net> on 2012/12/01 22:09:21 UTC

Re: Use of OGNL expression to access request headers

Sorry about the delay, I've been out of the net for some time.


I think tiles uses the singular form to access the map of headers.

How about:
<put-attribute name="test"
expression="OGNL:header['x-requested-with']"  cascade="true"/>

Hope this helps,
Nick


On 12-10-30 05:13 AM, Jose Luis Martinez Avial wrote:
> Any ideas?
> 
> -------------------------------
> José  Luis Martínez-Avial
> Web Applications Global Head
> Information Technology
> Santander Private Banking
>  
> 1401 Brickell Avenue, Suite 1500, Miami FL 33131
> Phone: 305.539.2417
> 
> -----Original Message-----
> From: Jose Luis Martinez Avial 
> Sent: Wednesday, October 24, 2012 11:44 PM
> To: users@tiles.apache.org
> Subject: Use of OGNL expression to access request headers
> 
> Hi,
> 	I'm using Tiles 2.2.2  in my application (Struts 2.2.3). I want to use expressions in order to modify my screen composition depending on some attribute in the request. Basically, I would like to change the extends of a screen depending if there is a header in the request with name "x-requested-with" and the value is "XMLHttpRequest". Is it possible to do that? I've tried to do a simple example with an attribute:
> 
> <put-attribute name="test"   expression="OGNL:requestScope"  cascade="true"/>
> 
> I've tried different expressions like OGNL:%{#request.headers.referer}, OGNL:#request.headers.referer, OGNL:requestScope.headers.referer , etc. But it always returns null. I haven't found any documentation on how the OGNL expressions works on Tiles, so I'm working based on how I would do it with Struts. But it doesn't seem to work. Can somebody help me?
> 
> Thanks
> 
> JL
> 
> 
> Internet communications are not secure and therefore Banco 
> Santander International does not accept legal responsibility for 
> the contents of this message. Any views or opinions presented 
> are solely those of the author and do not necessarily represent 
> those of Banco Santander International unless otherwise 
> specifically stated. 
> 
> Las comunicaciones vía Internet no son seguras y, por lo tanto,
> Banco Santander International no asume responsabilidad legal 
> ni de ningún otro tipo por el contenido de este mensaje. 
> Cualquier opinión transmitida pertenece únicamente al autor y 
> no necesariamente representa la opinión de Banco Santander 
> International, a no ser que esté expresamente detallado.
>