com.atlassian.jira.util.velocity
Class VelocityRequestContextFactory

java.lang.Object
  extended by com.atlassian.jira.util.velocity.VelocityRequestContextFactory

public class VelocityRequestContextFactory
extends Object

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

Constructor Detail

VelocityRequestContextFactory

public VelocityRequestContextFactory(ApplicationProperties applicationProperties)

VelocityRequestContextFactory

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

Method Detail

getJiraVelocityRequestContext

public VelocityRequestContext getJiraVelocityRequestContext()

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(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-2007 Atlassian. All Rights Reserved.