com.atlassian.jira.util.velocity
Class DefaultVelocityRequestContextFactory

java.lang.Object
  extended by com.atlassian.jira.util.velocity.DefaultVelocityRequestContextFactory
All Implemented Interfaces:
VelocityRequestContextFactory

public class DefaultVelocityRequestContextFactory
extends java.lang.Object
implements VelocityRequestContextFactory

Return an instance of VelocityRequestContext, depending on whether we are called from a web or non-web context.

The original intention of this class is to get around bugs such as JRA-11038, where velocity fragments are called from both web and non-web contexts. Originally we tried to proxy HttpServletRequest, but it makes more sense to have a specific interface VelocityRequestContext.


Constructor Summary
DefaultVelocityRequestContextFactory()
          Deprecated. Please use DefaultVelocityRequestContextFactory(com.atlassian.jira.config.properties.ApplicationProperties) instead
DefaultVelocityRequestContextFactory(ApplicationProperties applicationProperties)
           
 
Method Summary
static void cacheVelocityRequestContext(javax.servlet.http.HttpServletRequest request)
          Called from a servlet filter.
static void cacheVelocityRequestContext(java.lang.String baseUrl, javax.servlet.http.HttpServletRequest request)
          Should be called from a servlet filter before the request gets a chance to run
 VelocityRequestContext getJiraVelocityRequestContext()
          Get the request context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultVelocityRequestContextFactory

public DefaultVelocityRequestContextFactory(ApplicationProperties applicationProperties)

DefaultVelocityRequestContextFactory

public DefaultVelocityRequestContextFactory()
Deprecated. Please use DefaultVelocityRequestContextFactory(com.atlassian.jira.config.properties.ApplicationProperties) instead

Method Detail

getJiraVelocityRequestContext

public VelocityRequestContext getJiraVelocityRequestContext()
Description copied from interface: VelocityRequestContextFactory
Get the request context.

Specified by:
getJiraVelocityRequestContext in interface VelocityRequestContextFactory
Returns:
The request context

cacheVelocityRequestContext

public static void cacheVelocityRequestContext(javax.servlet.http.HttpServletRequest request)
Called from a servlet filter. Passes the HttpServletRequest.getContextPath() along as the baseUrl.

Parameters:
request - The HttpServletRequest used to construct the RequestContextParameterHolder

cacheVelocityRequestContext

public static void cacheVelocityRequestContext(java.lang.String baseUrl,
                                               javax.servlet.http.HttpServletRequest request)
Should be called from a servlet filter before the request gets a chance to run

Parameters:
baseUrl - Should pass in HttpServletRequest.getContextPath()
request - The HttpServletRequest used to construct the RequestContextParameterHolder


Copyright © 2002-2010 Atlassian. All Rights Reserved.