title: Get server name and scheme in freemarker with Spring MVC?
body: <p>I'm using Freemarker as my view technology for a Spring MVC application. I need to find the server name and scheme and nothing I try seems to work. In JSP, there is an implicit <code>request</code> object that would have this info, but Freemarker doesn't seem to have an equivalent. I am exposing the Spring <code>requestContext</code> as <code>rc</code>, but <code>rc.request</code> is null.</p>
  
  <p>Here is my view resolver config:</p>
  
  <pre><code>&lt;bean id="freemarkerViewResolver"
      class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"&gt;
      &lt;property name="cache" value="false" /&gt;
      &lt;property name="suffix" value=".ftl" /&gt;
      &lt;property name="order" value="1" /&gt;
      &lt;property name="exposeRequestAttributes" value="true" /&gt;
      &lt;property name="requestContextAttribute" value="rc" /&gt;
      &lt;property name="exposeSpringMacroHelpers" value="true" /&gt;
  &lt;/bean&gt;
  
  
  &lt;bean id="freemarkerConfig"
      class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"&gt;
      &lt;property name="templateLoaderPaths"&gt;
          &lt;list&gt;
              &lt;value&gt;${freemarker.templatePath}&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="defaultEncoding" value="UTF-8" /&gt;
  &lt;/bean&gt;
  </code></pre>