public class OmniPartialViewContext extends PartialViewContextWrapper
This OmniFaces partial view context extends and improves the standard partial view context as follows:
PartialResponseWriter.startEval()
.ViewExpiredException
occurs during an ajax request on a page which
is restricted by web.xml
<security-constraint>
. The enduser will now properly be
redirected to the login page instead of retrieving an ajax response with only a changed view state (and effectively
thus no visual feedback at all).Ajax
utility class to easily add callback scripts and arguments.
This partial view context is already registered by OmniFaces' own faces-config.xml
and thus gets
auto-initialized when the OmniFaces JAR is bundled in a web application, so end-users do not need to register this
partial view context explicitly themselves.
OmniPartialViewContextFactory
,
FullAjaxExceptionHandler
,
WebXml
,
Ajax
,
Json
ALL_PARTIAL_PHASE_CLIENT_IDS, PARTIAL_EVENT_PARAM_NAME, PARTIAL_EXECUTE_PARAM_NAME, PARTIAL_RENDER_PARAM_NAME, RESET_VALUES_PARAM_NAME
Constructor and Description |
---|
OmniPartialViewContext(PartialViewContext wrapped)
Construct a new OmniFaces partial view context around the given wrapped partial view context.
|
Modifier and Type | Method and Description |
---|---|
void |
addArgument(String name,
Object value)
Add an argument to the partial response.
|
void |
addCallbackScript(String callbackScript)
Add a callback script to the partial response.
|
void |
closePartialResponse()
Close the partial response.
|
static OmniPartialViewContext |
getCurrentInstance()
Returns the current instance of the OmniFaces partial view context.
|
static OmniPartialViewContext |
getCurrentInstance(FacesContext context)
Returns the current instance of the OmniFaces partial view context from the given faces context.
|
PartialResponseWriter |
getPartialResponseWriter() |
void |
processPartial(PhaseId phaseId)
An override which checks if the web.xml security constraint has been triggered during this ajax request
(which can happen when the session has been timed out) and if so, then perform a redirect to the originally
requested page.
|
void |
resetPartialResponse()
Reset the partial response.
|
void |
setPartialRequest(boolean partialRequest) |
getEvalScripts, getExecuteIds, getRenderIds, getWrapped, isAjaxRequest, isExecuteAll, isPartialRequest, isRenderAll, isResetValues, release, setRenderAll
public OmniPartialViewContext(PartialViewContext wrapped)
wrapped
- The wrapped partial view context.public PartialResponseWriter getPartialResponseWriter()
getPartialResponseWriter
in class PartialViewContextWrapper
public void processPartial(PhaseId phaseId)
processPartial
in class PartialViewContextWrapper
public void setPartialRequest(boolean partialRequest)
setPartialRequest
in class PartialViewContextWrapper
public void addArgument(String name, Object value)
OmniFaces.Ajax.data
.
For supported argument value types, read Json.encode(Object)
. If a given argument type is not supported,
then an IllegalArgumentException
will be thrown during end of render response.name
- The argument name.value
- The argument value.public void addCallbackScript(String callbackScript)
callbackScript
- The callback script to be added to the partial response.public void resetPartialResponse()
PartialResponseWriter
.FullAjaxExceptionHandler
public void closePartialResponse()
FullAjaxExceptionHandler
public static OmniPartialViewContext getCurrentInstance()
IllegalStateException
- When there is no current instance of the OmniFaces partial view context. That can
happen when the OmniPartialViewContextFactory
is not properly registered, or when there's another
PartialViewContext
implementation which doesn't properly delegate through the wrapped instance.public static OmniPartialViewContext getCurrentInstance(FacesContext context)
context
- The faces context to obtain the current instance of the OmniFaces partial view context from.IllegalStateException
- When there is no current instance of the OmniFaces partial view context. That can
happen when the OmniPartialViewContextFactory
is not properly registered, or when there's another
PartialViewContext
implementation which doesn't properly delegate through the wrapped instance.Copyright © 2012–2018 OmniFaces. All rights reserved.