Java Code Examples for javax.faces.context.FacesContext#isPostback()

The following examples show how to use javax.faces.context.FacesContext#isPostback() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void afterPhase(PhaseEvent event)
{
    FacesContext facesContext = event.getFacesContext();

    //only check full POST requests
    if (facesContext.isPostback() && !facesContext.getPartialViewContext().isAjaxRequest())
    {
        String receivedPostRequestToken = facesContext.getExternalContext()
            .getRequestParameterMap().get(PostRequestTokenMarker.POST_REQUEST_TOKEN_KEY);

        if (receivedPostRequestToken == null)
        {
            receivedPostRequestToken = findPostRequestTokenWithPrefix(facesContext);
        }

        if (!this.postRequestTokenManager.isValidRequest(receivedPostRequestToken))
        {
            facesContext.renderResponse();
        }
    }
}
 
Example 2
@Override
public void handleNavigation(FacesContext context, String fromAction, String outcome)
{
    // remember viewId before navigation
    String viewId = null;
    if (context.getViewRoot() != null)
    {
        viewId = context.getViewRoot().getViewId();
    }

    this.navigationHandler.handleNavigation(context, fromAction, outcome);
    
    if (viewId != null && context.isPostback() /*need for supporting view-actions correctly - see DELTASPIKE-795*/)
    {
        lazyInit();

        ViewAccessContext viewAccessContext = contextExtension.getViewAccessScopedContext();
        if (viewAccessContext != null)
        {
            viewAccessContext.onProcessingViewFinished(viewId);
        }
    }
}
 
Example 3
protected boolean isPost(FacesContext facesContext)
{
    if (facesContext.isPostback())
    {
        return true;
    }

    Object request = facesContext.getExternalContext().getRequest();
    if (request instanceof HttpServletRequest)
    {
        if ("POST".equals(((HttpServletRequest) request).getMethod()))
        {
            return true;
        }
    }

    return false;
}