Class FreemarkerRequest

All Implemented Interfaces:
DispatchRequest, Request, RequestWrapper

public class FreemarkerRequest extends AbstractViewRequest
The FreeMarker-specific request context.
  • Constructor Details

    • FreemarkerRequest

      public FreemarkerRequest(DispatchRequest enclosedRequest, freemarker.core.Environment env)
      Constructor.
      Parameters:
      enclosedRequest - The request that exposes non-FreeMarker specific properties
      env - The FreeMarker environment.
  • Method Details

    • createServletFreemarkerRequest

      public static FreemarkerRequest createServletFreemarkerRequest(ApplicationContext applicationContext, freemarker.core.Environment env)
      Creates a new Freemarker request.
      Parameters:
      applicationContext - The application context.
      env - The Freemarker environment object.
      Returns:
      A new request.
    • getEnvironment

      public freemarker.core.Environment getEnvironment()
      Returns the environment object.
      Returns:
      The environment.
    • getRequestLocale

      public Locale getRequestLocale()
      Return the preferred Locale in which the client will accept content.
      Specified by:
      getRequestLocale in interface Request
      Overrides:
      getRequestLocale in class DispatchRequestWrapper
      Returns:
      The current request locale. It is the locale of the request object itself, and it is NOT the locale that the user wants to use. See LocaleResolver to implement strategies to resolve locales.
    • getPageScope

      public Map<String,Object> getPageScope()
      Returns the page scope.
      Returns:
      The page scope.
    • getAvailableScopes

      public List<String> getAvailableScopes()
      Description copied from class: DispatchRequestWrapper
      Returns all available scopes. The scopes are ordered according to their lifetime, the innermost, shorter lived scope appears first, and the outermost, longer lived scope appears last. Besides, the scopes "request" and "application" always included in the list.
      Specified by:
      getAvailableScopes in interface Request
      Overrides:
      getAvailableScopes in class DispatchRequestWrapper
      Returns:
      All the available scopes.
    • getPrintWriter

      public PrintWriter getPrintWriter()
      Returns a print writer to be used to write directly in the response.
      Specified by:
      getPrintWriter in interface Request
      Overrides:
      getPrintWriter in class DispatchRequestWrapper
      Returns:
      The print writer that writes in the response.
    • getWriter

      public Writer getWriter()
      Returns a writer to be used to write directly in the response.
      Specified by:
      getWriter in interface Request
      Overrides:
      getWriter in class DispatchRequestWrapper
      Returns:
      The writer that writes in the response.
    • getContext

      public Map<String,Object> getContext(String scope)
      Description copied from class: DispatchRequestWrapper
      Returns a context map, given the scope name. This method always return a map for all the scope names returned by getAvailableScopes(). That map may be writable, or immutable, depending on the implementation.
      Specified by:
      getContext in interface Request
      Overrides:
      getContext in class DispatchRequestWrapper
      Parameters:
      scope - The name of the scope.
      Returns:
      The context.