You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Russell E Glaue <rg...@cait.org> on 2006/08/09 22:20:57 UTC

accessing server environment variables in Velocity

In a Velocity template, how do I access a server environment variable like
   HTTP_USER_AGENT
   REMOTE_HOST
   REMOTE_USER
   HTTP_ACCEPT_LANGUAGE

etc...


-RG

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: accessing server environment variables in Velocity

Posted by Claude Brisson <cl...@renegat.net>.
If you are using the VelocityViewServlet (from the tools subproject),
you should be able to access those headers from VTL through the $request
object: 

$request.getHeader("User-Agent")
$request.remoteHost
$request.remoteUser
$request.getHeader("Accept-Language")
...

  Claude

Le mercredi 09 août 2006 à 15:20 -0500, Russell E Glaue a écrit :
> In a Velocity template, how do I access a server environment variable like
>    HTTP_USER_AGENT
>    REMOTE_HOST
>    REMOTE_USER
>    HTTP_ACCEPT_LANGUAGE
> 
> etc...
> 
> 
> -RG
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org