org.broadleafcommerce.common.web
Class BroadleafRequestContext

java.lang.Object
  extended by org.broadleafcommerce.common.web.BroadleafRequestContext

public class BroadleafRequestContext
extends Object

Convenient holder class for various objects to be automatically available on thread local without invoking the various services yourself

See Also:
BroadleafRequestProcessor}

Field Summary
protected  Map<String,Object> additionalProperties
           
protected  BroadleafCurrency broadleafCurrency
           
protected  Catalog currentCatalog
           
protected  Boolean ignoreSite
           
protected  Currency javaCurrency
           
protected  Locale javaLocale
           
protected  Locale locale
           
protected  org.springframework.context.MessageSource messageSource
           
protected  javax.servlet.http.HttpServletRequest request
           
protected  RequestDTO requestDTO
           
protected  javax.servlet.http.HttpServletResponse response
           
protected  SandBox sandbox
           
protected  Site site
           
protected  Theme theme
           
protected  TimeZone timeZone
           
protected  org.springframework.web.context.request.WebRequest webRequest
           
 
Constructor Summary
BroadleafRequestContext()
           
 
Method Summary
 Map<String,Object> getAdditionalProperties()
           
 BroadleafCurrency getBroadleafCurrency()
           
static BroadleafRequestContext getBroadleafRequestContext()
           
 Catalog getCurrentCatalog()
           
 Boolean getIgnoreSite()
           
 Currency getJavaCurrency()
          Returns the java.util.Currency constructed from the org.broadleafcommerce.common.currency.domain.BroadleafCurrency
 Locale getJavaLocale()
          Returns the java.util.Locale constructed from the org.broadleafcommerce.common.locale.domain.Locale.
 Locale getLocale()
           
 org.springframework.context.MessageSource getMessageSource()
           
 javax.servlet.http.HttpServletRequest getRequest()
          Gets the current request on the context
 RequestDTO getRequestDTO()
           
static Map<String,String[]> getRequestParameterMap()
           
 String getRequestURIWithoutContext()
           
 javax.servlet.http.HttpServletResponse getResponse()
          Returns the response for the context
 SandBox getSandbox()
           
 Site getSite()
           
 Theme getTheme()
           
 TimeZone getTimeZone()
           
 org.springframework.web.context.request.WebRequest getWebRequest()
          Returns the generic request for use outside of servlets (like in Portlets).
static boolean hasCurrency()
           
static boolean hasLocale()
           
 boolean isProductionSandbox()
           
 boolean isSecure()
           
 void setAdditionalProperties(Map<String,Object> additionalProperties)
           
 void setBroadleafCurrency(BroadleafCurrency broadleafCurrency)
           
static void setBroadleafRequestContext(BroadleafRequestContext broadleafRequestContext)
           
 void setCurrentCatalog(Catalog currentCatalog)
           
 void setIgnoreSite(Boolean ignoreSite)
           
 void setLocale(Locale locale)
           
 void setMessageSource(org.springframework.context.MessageSource messageSource)
           
 void setRequest(javax.servlet.http.HttpServletRequest request)
          Sets the current request on the context.
 void setRequestDTO(RequestDTO requestDTO)
           
 void setResponse(javax.servlet.http.HttpServletResponse response)
          Sets the response on the context
 void setSandbox(SandBox sandbox)
           
 void setSite(Site site)
           
 void setTheme(Theme theme)
           
 void setTimeZone(TimeZone timeZone)
           
 void setWebRequest(org.springframework.web.context.request.WebRequest webRequest)
          Sets the generic request on the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected javax.servlet.http.HttpServletRequest request

response

protected javax.servlet.http.HttpServletResponse response

webRequest

protected org.springframework.web.context.request.WebRequest webRequest

sandbox

protected SandBox sandbox

locale

protected Locale locale

timeZone

protected TimeZone timeZone

broadleafCurrency

protected BroadleafCurrency broadleafCurrency

site

protected Site site

theme

protected Theme theme

javaLocale

protected Locale javaLocale

javaCurrency

protected Currency javaCurrency

currentCatalog

protected Catalog currentCatalog

ignoreSite

protected Boolean ignoreSite

additionalProperties

protected Map<String,Object> additionalProperties

messageSource

protected org.springframework.context.MessageSource messageSource

requestDTO

protected RequestDTO requestDTO
Constructor Detail

BroadleafRequestContext

public BroadleafRequestContext()
Method Detail

getBroadleafRequestContext

public static BroadleafRequestContext getBroadleafRequestContext()

setBroadleafRequestContext

public static void setBroadleafRequestContext(BroadleafRequestContext broadleafRequestContext)

hasLocale

public static boolean hasLocale()

hasCurrency

public static boolean hasCurrency()

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Gets the current request on the context

Returns:

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest request)
Sets the current request on the context. Note that this also invokes setWebRequest(WebRequest) by wrapping request in a ServletWebRequest.

Parameters:
request -

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Returns the response for the context

Returns:

setResponse

public void setResponse(javax.servlet.http.HttpServletResponse response)
Sets the response on the context

Parameters:
response -

setWebRequest

public void setWebRequest(org.springframework.web.context.request.WebRequest webRequest)
Sets the generic request on the context. This is available to be used in non-Servlet environments (like Portlets). Note that if webRequest is an instance of ServletWebRequest then setRequest(HttpServletRequest) will be invoked as well with the native underlying HttpServletRequest passed as a parameter.

Also, if webRequest is an instance of ServletWebRequest then an attempt is made to set the response (note that this could be null if the ServletWebRequest was not instantiated with both the HttpServletRequest and HttpServletResponse

Parameters:
webRequest -

getWebRequest

public org.springframework.web.context.request.WebRequest getWebRequest()
Returns the generic request for use outside of servlets (like in Portlets). This will be automatically set by invoking setRequest(HttpServletRequest)

Returns:
the generic request
See Also:
#setWebRequest(WebRequest)}

getSite

public Site getSite()

setSite

public void setSite(Site site)

getSandbox

public SandBox getSandbox()

setSandbox

public void setSandbox(SandBox sandbox)

getLocale

public Locale getLocale()

getJavaLocale

public Locale getJavaLocale()
Returns the java.util.Locale constructed from the org.broadleafcommerce.common.locale.domain.Locale.

Returns:

getJavaCurrency

public Currency getJavaCurrency()
Returns the java.util.Currency constructed from the org.broadleafcommerce.common.currency.domain.BroadleafCurrency

Returns:

setLocale

public void setLocale(Locale locale)

getRequestURIWithoutContext

public String getRequestURIWithoutContext()

isSecure

public boolean isSecure()

isProductionSandbox

public boolean isProductionSandbox()

getTheme

public Theme getTheme()

setTheme

public void setTheme(Theme theme)

getBroadleafCurrency

public BroadleafCurrency getBroadleafCurrency()

setBroadleafCurrency

public void setBroadleafCurrency(BroadleafCurrency broadleafCurrency)

getCurrentCatalog

public Catalog getCurrentCatalog()

setCurrentCatalog

public void setCurrentCatalog(Catalog currentCatalog)

getRequestParameterMap

public static Map<String,String[]> getRequestParameterMap()

getIgnoreSite

public Boolean getIgnoreSite()

setIgnoreSite

public void setIgnoreSite(Boolean ignoreSite)

getAdditionalProperties

public Map<String,Object> getAdditionalProperties()

setAdditionalProperties

public void setAdditionalProperties(Map<String,Object> additionalProperties)

getMessageSource

public org.springframework.context.MessageSource getMessageSource()

setMessageSource

public void setMessageSource(org.springframework.context.MessageSource messageSource)

getTimeZone

public TimeZone getTimeZone()

setTimeZone

public void setTimeZone(TimeZone timeZone)

getRequestDTO

public RequestDTO getRequestDTO()

setRequestDTO

public void setRequestDTO(RequestDTO requestDTO)


Copyright © 2013. All Rights Reserved.