Comment accéder à la Session ou de l'objet de Demande de la Vitesse de Modèle

Je suis en train d'essayer d'accéder à HttpServletRequest dans certains de vitesse modèle, mais n'y arrive jamais.
J'ai déjà essayé de suivre la saveur de la syntaxe

URL: $req.get("attributs").get("CURRENT_URL"))
Résultat > URL: $req.get("attributs").get("CURRENT_URL"))

URL: $demande.get("attributs").get("CURRENT_URL"))
Résultat > URL: $demande.get("attributs").get("CURRENT_URL"))

URL: $demande.get("attributs").get("CURRENT_URL"))
Résultat > URL: $demande.get("attributs").get("CURRENT_URL"))

URL: ${demande.get("attributs").get("CURRENT_URL"))}
Résultat > URL: ${demande.get("attributs").get("CURRENT_URL"))}

Note : Web.xml ressemble

<!-- Processes application requests -->
<servlet>
    <servlet-name>appServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<!-- Define Velocity template compiler -->
<servlet>
  <servlet-name>velocity</servlet-name>
  <servlet-class>
    org.apache.velocity.tools.view.servlet.VelocityViewServlet
  </servlet-class>

  <!-- 
   Unless you plan to put your toolbox.xml and velocity.properties
   under different folders or give them different names, then these
   two init-params are unnecessary as of VelocityTools 1.3.  The
   VelocityViewServlet will automatically look for these files in
   the following locations.
 -->
  <init-param>
    <param-name>org.apache.velocity.toolbox</param-name>
    <param-value>/WEB-INF/toolbox.xml</param-value>
  </init-param>

  <init-param>
    <param-name>org.apache.velocity.properties</param-name>
    <param-value>/WEB-INF/velocity.properties</param-value>
  </init-param>
</servlet>

<!-- Map *.vm files to Velocity -->
<servlet-mapping>
  <servlet-name>velocity</servlet-name>
  <url-pattern>*.vm</url-pattern>
</servlet-mapping>

OriginalL'auteur Ifi | 2012-08-23