本文整理汇总了Java中javax.faces.context.FacesContext.renderResponse方法的典型用法代码示例。如果您正苦于以下问题:Java FacesContext.renderResponse方法的具体用法?Java FacesContext.renderResponse怎么用?Java FacesContext.renderResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.context.FacesContext
的用法示例。
在下文中一共展示了FacesContext.renderResponse方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: __handleQueueEvent
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
/**
* This method sets the phaseID of the event
* according to the "immediate" property of this
* component.
* If "immediate" is set to true, this calls
* {@link FacesContext#renderResponse}
*/
static void __handleQueueEvent(UIComponent comp, FacesEvent event)
{
if (_isImmediateEvent(comp, event))
{
String immediateAttr = UIXTree.IMMEDIATE_KEY.getName();
Object isImmediate = comp.getAttributes().get(immediateAttr);
if (Boolean.TRUE.equals(isImmediate))
{
event.setPhaseId(PhaseId.ANY_PHASE);
FacesContext context = FacesContext.getCurrentInstance();
context.renderResponse();
}
else
{
// the event should not execute before model updates are done.
// otherwise, the updates will be done to the wrong rows.
// we can't do this at the end of the UPDATE_MODEL phase because
// if there are errors during that phase, then we want to immediately render
// the response, and not deliver this ui event:
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
}
}
示例2: _executeValidate
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
/**
* Executes validation logic.
*/
private void _executeValidate(FacesContext context)
{
Application application = context.getApplication();
application.publishEvent(context, PreValidateEvent.class, UIComponent.class, this);
try
{
validate(context);
}
catch (RuntimeException e)
{
context.renderResponse();
throw e;
}
finally
{
application.publishEvent(context, PostValidateEvent.class, UIComponent.class, this);
}
if (!isValid())
{
context.renderResponse();
}
}
示例3: handleViewExpiredException
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private void handleViewExpiredException(ViewExpiredException vee) {
LOG.log(Level.INFO, " handling viewExpiredException...");
FacesContext context = FacesContext.getCurrentInstance();
String viewId = vee.getViewId();
LOG.log(Level.INFO, "view id @" + viewId);
NavigationHandler nav
= context.getApplication().getNavigationHandler();
nav.handleNavigation(context, null, viewId);
context.renderResponse();
}
示例4: handleNotFoundException
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
private void handleNotFoundException(Exception e) {
LOG.log(Level.INFO, "handling exception:...");
FacesContext context = FacesContext.getCurrentInstance();
String viewId = "/error.xhtml";
LOG.log(Level.INFO, "view id @" + viewId);
NavigationHandler nav
= context.getApplication().getNavigationHandler();
nav.handleNavigation(context, null, viewId);
context.getViewRoot().getViewMap(true).put("ex", e);
context.renderResponse();
}
示例5: decode
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void decode(
FacesContext facesContext,
UIComponent component,
@SuppressWarnings("unused")
FacesBean facesBean,
String clientId)
{
Map<String, String> parameters =
facesContext.getExternalContext().getRequestParameterMap();
Object event = parameters.get(XhtmlConstants.EVENT_PARAM);
// get the goto event parameter values and queue a RangeChangeEvent.
if (XhtmlConstants.GOTO_EVENT.equals(event))
{
Object source = parameters.get(XhtmlConstants.SOURCE_PARAM);
String id = clientId == null ? component.getClientId(facesContext) : clientId;
if (id.equals(source))
{
UIXSelectRange choiceBar = (UIXSelectRange)component;
Object valueParam = parameters.get(XhtmlConstants.VALUE_PARAM);
RangeChangeEvent rce = _createRangeChangeEvent(choiceBar, valueParam);
rce.queue();
if (choiceBar.isImmediate())
facesContext.renderResponse();
RequestContext.getCurrentInstance().addPartialTarget(component);
}
}
}
示例6: decode
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void decode(
FacesContext facesContext,
UIComponent component,
@SuppressWarnings("unused")
FacesBean facesBean,
String clientId)
{
Map<String, String> parameters =
facesContext.getExternalContext().getRequestParameterMap();
Object event = parameters.get(XhtmlConstants.EVENT_PARAM);
if (XhtmlConstants.POLL_EVENT.equals(event))
{
Object source = parameters.get(XhtmlConstants.SOURCE_PARAM);
String id = clientId == null ? component.getClientId(facesContext) : clientId;
if (id.equals(source))
{
// This component always uses PPR (unless not supported at all)
PartialPageUtils.forcePartialRendering(facesContext);
// And forcibly re-render ourselves - because that's how
// we get the poll re-started
RequestContext.getCurrentInstance().addPartialTarget(component);
UIXPoll poll = (UIXPoll) component;
(new PollEvent(component)).queue();
if (poll.isImmediate())
facesContext.renderResponse();
}
}
}
示例7: processUpdates
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
@Override
public void processUpdates(FacesContext context)
{
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.pushCurrentComponent(context, this);
pushComponentToEL(context, this);
try
{
// Skip processing if our rendered flag is false
if (!isRendered())
return;
super.processUpdates(context);
// Process this component itself
updateModel(context);
}
finally
{
popComponentFromEL(context);
requestContext.popCurrentComponent(context, this);
}
if (!isValid())
{
context.renderResponse();
}
}
示例8: goToErrorPage
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
/**
* @param context
* @param e
* @throws Throwable
*/
private void goToErrorPage(FacesContext context, Throwable e) {
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
request.setAttribute(ERROR_EXCEPTION + "_stacktrace", e);
if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
throw new FacesException(e);
}
if (e instanceof FileNotFoundException) {
logger.log(Level.WARNING,"File not found", e);
throw new FacesException(e);
}
request.setAttribute(ERROR_EXCEPTION_TYPE, e.getClass().getName());
request.setAttribute(ERROR_MESSAGE, e.getMessage());
request.setAttribute(ERROR_REQUEST_URI, request.getHeader("Referer"));
request.setAttribute(ERROR_STATUS_CODE, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
String errorPage = findErrorPage(e);
if (!has(errorPage)) {
String errorPageParam = context.getExternalContext().getInitParameter(Constants.InitialParams.ERROR_PAGE);
if (!has(errorPageParam)) {
errorPage = Constants.DEFAULT_ERROR_PAGE;
}
}
context.getApplication().getNavigationHandler().handleNavigation(context, null, errorPage);
context.renderResponse();
}
示例9: handleBusinessException
import javax.faces.context.FacesContext; //导入方法依赖的package包/类
/**
* @param context
* @param e application business exception
*/
private void handleBusinessException(FacesContext context, BusinessException e) {
if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
throw new FacesException(e);
}
if (has(e.getExceptionList())) {
for (BusinessException be : e.getExceptionList()) {
addFacesMessage(be);
}
} else { //Single exception
addFacesMessage(e);
}
validationFailed();
context.renderResponse();
}