ro.isdc.wro.config
Class Context

java.lang.Object
  extended by ro.isdc.wro.config.Context

public class Context
extends Object

Holds the properties related to a request cycle.

Author:
Alex Objelean

Method Summary
static void destroy()
          Perform context clean-up.
static Context get()
           
 String getAggregatedFolderPath()
           
 WroConfiguration getConfig()
           
 javax.servlet.FilterConfig getFilterConfig()
           
 javax.servlet.http.HttpServletRequest getRequest()
           
 javax.servlet.http.HttpServletResponse getResponse()
           
 javax.servlet.ServletContext getServletContext()
           
static boolean isContextSet()
           
static void set(Context context)
           
static void set(Context context, WroConfiguration config)
          Associate a context with the CURRENT request cycle.
 void setAggregatedFolderPath(String aggregatedFolderPath)
          This field is useful only for the aggregated resources of type ResourceType.CSS.
 void setConfig(WroConfiguration config)
          DO NOT CALL THIS METHOD UNLESS YOU ARE SURE WHAT YOU ARE DOING.
static Context standaloneContext()
          A context useful for running in non web context (standAlone applications).
 String toString()
          
static void unset()
          Remove context from the local thread.
static Context webContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterConfig filterConfig)
          A context useful for running in web context (inside a servlet container).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getConfig

public WroConfiguration getConfig()
Returns:
WroConfiguration singleton instance.

setConfig

public void setConfig(WroConfiguration config)
DO NOT CALL THIS METHOD UNLESS YOU ARE SURE WHAT YOU ARE DOING.

sets the WroConfiguration singleton instance.


webContext

public static Context webContext(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 javax.servlet.FilterConfig filterConfig)
A context useful for running in web context (inside a servlet container).


standaloneContext

public static Context standaloneContext()
A context useful for running in non web context (standAlone applications).


get

public static Context get()
Returns:
Context associated with CURRENT request cycle.

isContextSet

public static boolean isContextSet()
Returns:
true if the call is done during wro4j request cycle. In other words, if the context is set.

set

public static void set(Context context)

set

public static void set(Context context,
                       WroConfiguration config)
Associate a context with the CURRENT request cycle.

Parameters:
context - Context to set.

unset

public static void unset()
Remove context from the local thread.


getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Returns:
the request

getResponse

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

getServletContext

public javax.servlet.ServletContext getServletContext()
Returns:
the servletContext

getFilterConfig

public javax.servlet.FilterConfig getFilterConfig()
Returns:
the filterConfig

getAggregatedFolderPath

public String getAggregatedFolderPath()
Returns:
the aggregatedFolderPath

setAggregatedFolderPath

public void setAggregatedFolderPath(String aggregatedFolderPath)
This field is useful only for the aggregated resources of type ResourceType.CSS.
The aggregatedFolderPath is used to compute the depth. For example, if aggregatedFolder is "wro" then the depth is 1 and the path used to prefix the image url is "..". If the aggregatedFolder is "css/aggregated", the depth is 2 and the prefix is "../..". The name of the aggregated folder is not important, it is used only to compute the depth.

Parameters:
aggregatedFolderPath - the aggregatedFolderPath to set

destroy

public static void destroy()
Perform context clean-up.


toString

public String toString()

Overrides:
toString in class Object


Copyright © 2008-2011. All Rights Reserved.