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  BroadleafCurrency broadleafCurrency
           
protected  Currency javaCurrency
           
protected  Locale javaLocale
           
protected  Locale locale
           
protected  javax.servlet.http.HttpServletRequest request
           
protected  javax.servlet.http.HttpServletResponse response
           
protected  SandBox sandbox
           
protected  Site site
           
protected  Theme theme
           
protected  org.springframework.web.context.request.WebRequest webRequest
           
 
Constructor Summary
BroadleafRequestContext()
           
 
Method Summary
 BroadleafCurrency getBroadleafCurrency()
           
static BroadleafRequestContext getBroadleafRequestContext()
           
 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()
           
 javax.servlet.http.HttpServletRequest getRequest()
          Gets the current request on the context
static Map<String,String[]> getRequestParameterMap()
           
 String getRequestURIWithoutContext()
           
 javax.servlet.http.HttpServletResponse getResponse()
          Returns the response for the context
 SandBox getSandbox()
           
 Site getSite()
           
 Theme getTheme()
           
 org.springframework.web.context.request.WebRequest getWebRequest()
          Returns the generic request for use outside of servlets (like in Portlets).
static boolean hasLocale()
           
 boolean isProductionSandbox()
           
 boolean isSecure()
           
 void setBroadleafCurrency(BroadleafCurrency broadleafCurrency)
           
static void setBroadleafRequestContext(BroadleafRequestContext broadleafRequestContext)
           
 void setLocale(Locale locale)
           
 void setRequest(javax.servlet.http.HttpServletRequest request)
          Sets the current request on the context.
 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 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

broadleafCurrency

protected BroadleafCurrency broadleafCurrency

site

protected Site site

theme

protected Theme theme

javaLocale

protected Locale javaLocale

javaCurrency

protected Currency javaCurrency
Constructor Detail

BroadleafRequestContext

public BroadleafRequestContext()
Method Detail

getBroadleafRequestContext

public static BroadleafRequestContext getBroadleafRequestContext()

setBroadleafRequestContext

public static void setBroadleafRequestContext(BroadleafRequestContext broadleafRequestContext)

hasLocale

public static boolean hasLocale()

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)

getRequestParameterMap

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


Copyright © 2013. All Rights Reserved.