[OmniFaces utilities] The
responseComplete()
method signals JSF that the response for this request has already been generated (such as providing a file download), and that the lifecycle should be terminated as soon as the current phase is completed.[OmniFaces utilities] The
isResponseComplete()
method returns true
if the FacesContext#responseComplete()
has been called.Methods:
Usage:
Invoke Faces#isResponseComplete()
without Faces#responseComplete():
import
org.omnifaces.util.Faces;
...
boolean isRC
= Faces.isResponseComplete(); // returns false
if(isRC){
// FacesContext#responseComplete()was invoked
} else {
// FacesContext#responseComplete()wasn't
invoked
}
Now invoke Faces#responseComplete() before Faces#isResponseComplete():
import
org.omnifaces.util.Faces;
...
Faces.responseComplete();
boolean isRC
= Faces.isResponseComplete(); // returns true
if(isRC){
// FacesContext#responseComplete()was invoked
} else {
// FacesContext#responseComplete()wasn't
invoked
}
The Faces#responseComplete() can be used after an explicit renderView() call:
The Faces#responseComplete() can be used after an explicit renderView() call:
import
org.omnifaces.util.Faces;
...
ViewDeclarationLanguage
vdl = ...;
...
vdl.renderView(...);
Faces.responseComplete();
Or, after an
explicit write():
ExternalContext
externalContext = ...;
externalContext.setResponseContentType("text/xml");
externalContext.getResponseOutputWriter().write(some_content);
Faces.responseComplete();
Niciun comentariu :
Trimiteți un comentariu