public class PrettyContext extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_KEY |
static String |
PRETTY_PREFIX |
| Modifier | Constructor and Description |
|---|---|
protected |
PrettyContext(HttpServletRequest request)
Must create instance through the initialize() method
|
| Modifier and Type | Method and Description |
|---|---|
PrettyConfig |
getConfig()
Get the pretty-config.xml configurations as loaded by
PrettyConfigurator (This can be dynamically manipulated at runtime
in order to change or add any mappings. |
String |
getContextPath() |
static PrettyContext |
getCurrentInstance()
Get the current PrettyFaces context object, or construct a new one if it
does not yet exist for this request.
|
static PrettyContext |
getCurrentInstance(FacesContext context)
Get the current PrettyFaces context object, or construct a new one if it
does not yet exist for this request.
|
static PrettyContext |
getCurrentInstance(HttpServletRequest request)
Get the current
PrettyContext, or construct a new one if it does
not yet exist for this request. |
UrlMapping |
getCurrentMapping()
Get the
UrlMapping representing the current request. |
String |
getCurrentViewId()
Return the current viewId to which the current request will be forwarded
to JSF.
|
String |
getDynaViewId() |
QueryString |
getRequestQueryString()
Return the
QueryString representing the query-string with which
this request was populated. |
URL |
getRequestURL()
Return the
URL representing the path with which this request was
populated. |
boolean |
isDynaviewProcessed()
Return true if the current request has already processed the DynaView
life-cycle.
|
boolean |
isInNavigation()
Return whether or not this faces application is in the Navigation State
|
static boolean |
isInstantiated(ServletRequest request)
Return true if there is an instantiated
PrettyContext contained in
the current given request object. |
boolean |
isPrettyRequest()
Determine if this request URL is mapped by PrettyFaces
|
static PrettyContext |
newDetachedInstance(HttpServletRequest request)
Package private -- only
PrettyFilter should be calling this method
-- it does not overwrite existing contexts in Request object |
void |
sendError(int code)
Sends an error response to the client using the specified HTTP status
code.
|
void |
sendError(int code,
String message)
Sends an error response to the client using the specified HTTP status
code.
|
void |
sendError(int code,
String message,
HttpServletResponse response)
Sends an error response to the client using the specified HTTP status
code.
|
static void |
setCurrentContext(HttpServletRequest request,
PrettyContext prettyContext)
Package private -- only PrettyFilter or this class should be calling this
method -- it overwrites existing contexts in Request object
|
void |
setDynaviewProcessed(boolean value) |
void |
setInNavigation(boolean value)
Set whether or not to treat this request as if it is in the Navigation
State
|
boolean |
shouldProcessDynaview() |
String |
stripContextPath(String uri)
If the given URL is prefixed with this request's context-path, return the
URI without the context path.
|
public static final String CONFIG_KEY
public static final String PRETTY_PREFIX
protected PrettyContext(HttpServletRequest request)
public static PrettyContext getCurrentInstance()
FacesContext.getCurrentInstance() to retrieve the current
HttpServletRequest object)public static PrettyContext getCurrentInstance(FacesContext context)
FacesContext to
retrieve the current HttpServletRequest object)public static PrettyContext getCurrentInstance(HttpServletRequest request)
PrettyContext, or construct a new one if it does
not yet exist for this request.public static boolean isInstantiated(ServletRequest request)
PrettyContext contained in
the current given request object.public static PrettyContext newDetachedInstance(HttpServletRequest request)
PrettyFilter should be calling this method
-- it does not overwrite existing contexts in Request objectpublic static void setCurrentContext(HttpServletRequest request, PrettyContext prettyContext)
public URL getRequestURL()
URL representing the path with which this request was
populated. (Does not include context-path.)public QueryString getRequestQueryString()
QueryString representing the query-string with which
this request was populated.public boolean isPrettyRequest()
public String getContextPath()
public String stripContextPath(String uri)
public PrettyConfig getConfig()
PrettyConfigurator (This can be dynamically manipulated at runtime
in order to change or add any mappings.public UrlMapping getCurrentMapping()
UrlMapping representing the current request.public String getCurrentViewId()
public boolean isInNavigation()
public void setInNavigation(boolean value)
public boolean shouldProcessDynaview()
public boolean isDynaviewProcessed()
public void setDynaviewProcessed(boolean value)
public String getDynaViewId()
public void sendError(int code)
Sends an error response to the client using the specified HTTP status code.
Please note that this method can only be called from within the JSF
lifecycle as it needs the FacesContext to obtain the
HttpServletResponse. Please use
sendError(int, String, HttpServletResponse) in all other
cases.
code - the error status codeHttpServletResponse.sendError(int, String)public void sendError(int code,
String message)
Sends an error response to the client using the specified HTTP status code.
Please note that this method can only be called from within the JSF
lifecycle as it needs the FacesContext to obtain the
HttpServletResponse. Please use
sendError(int, String, HttpServletResponse) in all other
cases.
code - the error status codemessage - the descriptive messageHttpServletResponse.sendError(int, String)public void sendError(int code,
String message,
HttpServletResponse response)
code - the error status codemessage - the descriptive messageresponse - HttpServletResponse.sendError(int, String)Copyright © 2014 OCPsoft. All Rights Reserved.