@Override public boolean isAjaxRequest() { return getWrapped().isAjaxRequest() || FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().containsKey("javax.faces.partial.ajax"); }
/** * Shortcut for {@link PartialViewContext#isAjaxRequest()}. * * @return <code>true</code> if the current request is a AJAX request. */ public boolean isAjaxRequest() { return getFacesContext().getPartialViewContext().isAjaxRequest(); }
protected boolean isGetLifecycleInfoRequest(FacesContext facesContext) { if (!facesContext.getPartialViewContext().isAjaxRequest()) { return false; } String source = facesContext.getExternalContext().getRequestParameterMap().get(Constants.RequestParams.PARTIAL_SOURCE_PARAM); if (LangUtils.isValueBlank(source)) { return false; } return facesContext.getExternalContext().getRequestParameterMap().containsKey(source + "_getlifecycleinfo"); } }
if (context.getPartialViewContext().isAjaxRequest()) { PrimeFaces.current().executeScript("if (document.getElementById('g-recaptcha-response')) { " + "try { grecaptcha.reset(); } catch (error) { PrimeFaces.error(error); } }");
if (context.getPartialViewContext().isAjaxRequest()) { handleAjaxException(context, rootCause, info);
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); encodeResources(context); if (!context.getPartialViewContext().isAjaxRequest()) { encodeOnloadScripts(writer); } writer.endElement("body"); }
@Override public void setResponseWriter(ResponseWriter writer) { if (!getPartialViewContext().isAjaxRequest() && moveScriptsToBottom && !(writer instanceof MoveScriptsToBottomResponseWriter)) { getWrapped().setResponseWriter(new MoveScriptsToBottomResponseWriter(writer, moveScriptsToBottomState)); } else { getWrapped().setResponseWriter(writer); } }
public WidgetBuilder init(String widgetClass, String widgetVar, String id) throws IOException { this.renderScriptBlock(id); // AJAX case: since jQuery 3 document ready ($(function() {})) are executed async // this would mean that our oncomplete handlers are probably called before the scripts in the update nodes // or // we can also skip it when MOVE_SCRIPTS_TO_BOTTOM is enabled as the scripts are already executed when everything is ready if ((context.isPostback() && context.getPartialViewContext().isAjaxRequest()) || configuration.isMoveScriptsToBottom()) { this.init(widgetClass, widgetVar, id, false); } else { context.getResponseWriter().write("$(function(){"); this.init(widgetClass, widgetVar, id, true); } return this; }
PartialViewContext pvc = facesContext.getPartialViewContext(); if(pvc.isAjaxRequest()) { // ... } else { // ... }
@Override public void afterPhase(PhaseEvent event) { FacesContext context = event.getFacesContext(); // we only need to collect resources on ajax requests // for non ajax, the head will always be rendered again if (context.getViewRoot() == null || !context.getPartialViewContext().isAjaxRequest()) { return; } // we can also skip non-postback ajax requests, which occurs e.g. without a form if (!context.isPostback()) { return; } // skip update=@all as the head, with all resources, will already be rendered if (context.getPartialViewContext().isRenderAll()) { return; } // JSF 2.3 contains a own dynamic resource handling if (PrimeApplicationContext.getCurrentInstance(context).getEnvironment().isAtLeastJsf23()) { return; } // collect all current resources before new components can be added to the view in later phases List<ResourceUtils.ResourceInfo> initialResources = ResourceUtils.getComponentResources(context); putInitialResources(context, initialResources); }
if (responseResetted && context.getPartialViewContext().isAjaxRequest()) { PartialResponseWriter writer = context.getPartialViewContext().getPartialResponseWriter(); externalContext.addResponseHeader("Content-Type", "text/xml; charset=" + externalContext.getResponseCharacterEncoding()); if (externalContext.isResponseCommitted() && !context.getPartialViewContext().isAjaxRequest()) { PartialResponseWriter writer = context.getPartialViewContext().getPartialResponseWriter(); writer.startElement("script", null);
/** * <p>The default behavior of this method is to * call {@link PartialViewContext#isAjaxRequest()} * on the wrapped {@link PartialViewContext} object.</p> * * @see javax.faces.context.PartialViewContext#isAjaxRequest() */ @Override public boolean isAjaxRequest() { return getWrapped().isAjaxRequest(); }
/** * <p>The default behavior of this method is to * call {@link PartialViewContext#isAjaxRequest()} * on the wrapped {@link PartialViewContext} object.</p> * * @see javax.faces.context.PartialViewContext#isAjaxRequest() */ @Override public boolean isAjaxRequest() { return getWrapped().isAjaxRequest(); }
@Override public boolean isAjaxRequest() { return getWrapped().isAjaxRequest(); }
@Override public ExceptionHandler getWrapped() { FacesContext fc = FacesContext.getCurrentInstance(); if (null != fc && fc.getPartialViewContext().isAjaxRequest()) { return ajaxExceptionHandlerImpl; } return exceptionHandlerImpl; }
/** * <p>The default behavior of this method is to * call {@link PartialViewContext#isAjaxRequest()} * on the wrapped {@link PartialViewContext} object.</p> * * @see javax.faces.context.PartialViewContext#isAjaxRequest() */ @Override public boolean isAjaxRequest() { return getWrapped().isAjaxRequest(); }
/** * Shortcut for {@link PartialViewContext#isAjaxRequest()}. * * @return <code>true</code> if the current request is a AJAX request. */ public boolean isAjaxRequest() { return getFacesContext().getPartialViewContext().isAjaxRequest(); }
/** * @since 2.0 */ @Override public boolean getRendersChildren() { // Call UIComponentBase.getRendersChildren() // If PartialViewContext.isAjaxRequest() returns true this method must return true. PartialViewContext context = getFacesContext().getPartialViewContext(); return (context.isAjaxRequest()) ? true : super.getRendersChildren(); }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); encodeResources(context); if (!context.getPartialViewContext().isAjaxRequest()) { encodeOnloadScripts(writer); } writer.endElement("body"); }
@Override public void setResponseWriter(ResponseWriter writer) { if (!getPartialViewContext().isAjaxRequest() && moveScriptsToBottom && !(writer instanceof MoveScriptsToBottomResponseWriter)) { getWrapped().setResponseWriter(new MoveScriptsToBottomResponseWriter(writer, moveScriptsToBottomState)); } else { getWrapped().setResponseWriter(writer); } }