Search in sources :

Example 11 with BridgeException

use of javax.portlet.faces.BridgeException in project liferay-faces-bridge-impl by liferay.

the class BridgePhaseCompat_2_0_Impl method throwQueuedExceptionIfNecessary.

protected void throwQueuedExceptionIfNecessary(FacesContext facesContext) throws BridgeException {
    // If there were any "handled" exceptions queued, then throw a BridgeException.
    ExceptionHandler exceptionHandler = facesContext.getExceptionHandler();
    Throwable t = getQueuedException(exceptionHandler, true);
    if (t == null) {
        // Otherwise, if there were any "unhandled" exceptions queued, then throw a BridgeException.
        t = getQueuedException(exceptionHandler, false);
    }
    if (t != null) {
        if (t instanceof BridgeException) {
            throw (BridgeException) t;
        } else {
            Throwable cause = t.getCause();
            if ((cause != null) && (cause instanceof BridgeInvalidViewPathException)) {
                throw (BridgeException) cause;
            } else {
                throw new BridgeException(t);
            }
        }
    }
}
Also used : ExceptionHandler(javax.faces.context.ExceptionHandler) BridgeException(javax.portlet.faces.BridgeException) BridgeInvalidViewPathException(javax.portlet.faces.BridgeInvalidViewPathException)

Example 12 with BridgeException

use of javax.portlet.faces.BridgeException in project liferay-faces-bridge-impl by liferay.

the class BridgeURLFactoryImpl method getBridgeBookmarkableURL.

@Override
public BridgeURL getBridgeBookmarkableURL(FacesContext facesContext, String uri, Map<String, List<String>> parameters) throws BridgeException {
    ExternalContext externalContext = facesContext.getExternalContext();
    ContextInfo contextInfo = new ContextInfo(facesContext.getViewRoot(), externalContext, facesContext.getResponseWriter());
    ClientWindowInfo clientWindowInfo = new ClientWindowInfo(externalContext);
    try {
        return new BridgeURLBookmarkableImpl(uri, contextInfo.contextPath, contextInfo.namespace, contextInfo.encoding, contextInfo.facesURLEncoder, contextInfo.currentFacesViewId, parameters, clientWindowInfo.isRenderModeEnabled(facesContext), clientWindowInfo.getId(), clientWindowInfo.getUrlParameters(facesContext), contextInfo.portletConfig, contextInfo.bridgeConfig);
    } catch (URISyntaxException | UnsupportedEncodingException e) {
        throw new BridgeException(e);
    }
}
Also used : BridgeException(javax.portlet.faces.BridgeException) ExternalContext(javax.faces.context.ExternalContext) UnsupportedEncodingException(java.io.UnsupportedEncodingException) URISyntaxException(java.net.URISyntaxException)

Example 13 with BridgeException

use of javax.portlet.faces.BridgeException in project liferay-faces-bridge-impl by liferay.

the class BridgeURLFactoryImpl method getBridgeRedirectURL.

@Override
public BridgeURL getBridgeRedirectURL(FacesContext facesContext, String uri, Map<String, List<String>> parameters) throws BridgeException {
    ExternalContext externalContext = facesContext.getExternalContext();
    ContextInfo contextInfo = new ContextInfo(facesContext.getViewRoot(), externalContext, facesContext.getResponseWriter());
    ClientWindowInfo clientWindowInfo = new ClientWindowInfo(externalContext);
    try {
        return new BridgeURLRedirectImpl(uri, contextInfo.contextPath, contextInfo.namespace, contextInfo.encoding, contextInfo.facesURLEncoder, parameters, clientWindowInfo.isRenderModeEnabled(facesContext), clientWindowInfo.getId(), clientWindowInfo.getUrlParameters(facesContext), contextInfo.portletConfig, contextInfo.bridgeConfig);
    } catch (URISyntaxException | UnsupportedEncodingException e) {
        throw new BridgeException(e);
    }
}
Also used : BridgeException(javax.portlet.faces.BridgeException) ExternalContext(javax.faces.context.ExternalContext) UnsupportedEncodingException(java.io.UnsupportedEncodingException) URISyntaxException(java.net.URISyntaxException)

Example 14 with BridgeException

use of javax.portlet.faces.BridgeException in project liferay-faces-bridge-impl by liferay.

the class BridgeURLFactoryImpl method getBridgeActionURL.

@Override
public BridgeURL getBridgeActionURL(FacesContext facesContext, String uri) throws BridgeException {
    ExternalContext externalContext = facesContext.getExternalContext();
    ContextInfo contextInfo = new ContextInfo(facesContext.getViewRoot(), externalContext, facesContext.getResponseWriter());
    ClientWindowInfo clientWindowInfo = new ClientWindowInfo(externalContext);
    try {
        return new BridgeURLActionImpl(uri, contextInfo.contextPath, contextInfo.namespace, contextInfo.encoding, contextInfo.facesURLEncoder, contextInfo.currentFacesViewId, clientWindowInfo.isRenderModeEnabled(facesContext), clientWindowInfo.getId(), clientWindowInfo.getUrlParameters(facesContext), contextInfo.portletConfig, contextInfo.bridgeConfig);
    } catch (URISyntaxException | UnsupportedEncodingException e) {
        throw new BridgeException(e);
    }
}
Also used : BridgeException(javax.portlet.faces.BridgeException) ExternalContext(javax.faces.context.ExternalContext) UnsupportedEncodingException(java.io.UnsupportedEncodingException) URISyntaxException(java.net.URISyntaxException)

Aggregations

BridgeException (javax.portlet.faces.BridgeException)14 ExternalContext (javax.faces.context.ExternalContext)8 UnsupportedEncodingException (java.io.UnsupportedEncodingException)5 URISyntaxException (java.net.URISyntaxException)4 ViewHandler (javax.faces.application.ViewHandler)2 PortletMode (javax.portlet.PortletMode)2 BridgeInvalidViewPathException (javax.portlet.faces.BridgeInvalidViewPathException)2 BridgeNavigationHandler (com.liferay.faces.bridge.application.internal.BridgeNavigationHandler)1 CapturingWriter (com.liferay.faces.bridge.context.internal.CapturingWriter)1 WriterOperation (com.liferay.faces.bridge.context.internal.WriterOperation)1 EventPayloadWrapper (com.liferay.faces.bridge.event.EventPayloadWrapper)1 IPCPhaseListener (com.liferay.faces.bridge.event.internal.IPCPhaseListener)1 BridgeRequestScope (com.liferay.faces.bridge.scope.internal.BridgeRequestScope)1 ResourceValidator (com.liferay.faces.util.application.ResourceValidator)1 ConfiguredServletMapping (com.liferay.faces.util.config.ConfiguredServletMapping)1 Product (com.liferay.faces.util.product.Product)1 Serializable (java.io.Serializable)1 Writer (java.io.Writer)1 FacesException (javax.faces.FacesException)1 NavigationHandler (javax.faces.application.NavigationHandler)1