Search in sources :

Example 6 with BridgeUninitializedException

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

the class BridgeImpl method doFacesRequest.

@Override
public void doFacesRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws BridgeDefaultViewNotSpecifiedException, BridgeUninitializedException, BridgeException {
    checkNull(actionRequest, actionResponse);
    if (initialized) {
        String nonFacesTargetPath = actionRequest.getParameter(Bridge.NONFACES_TARGET_PATH_PARAMETER);
        if (nonFacesTargetPath != null) {
            throw new BridgeNotAFacesRequestException(nonFacesTargetPath);
        }
        PortletConfig wrappedPortletConfig = BridgePortletConfigFactory.getPortletConfigInstance(portletConfig);
        BridgeConfig bridgeConfig = BridgeConfigFactory.getBridgeConfigInstance(wrappedPortletConfig);
        BridgePhase bridgePhase = new BridgePhaseActionImpl(actionRequest, actionResponse, wrappedPortletConfig, bridgeConfig);
        bridgePhase.execute();
    } else {
        throw new BridgeUninitializedException();
    }
}
Also used : PortletConfig(javax.portlet.PortletConfig) BridgeNotAFacesRequestException(javax.portlet.faces.BridgeNotAFacesRequestException) BridgeConfig(javax.portlet.faces.BridgeConfig) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException)

Example 7 with BridgeUninitializedException

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

the class BridgeDestroyTestPortlet method runRenderDestroyTest.

private void runRenderDestroyTest(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter responsePrintWriter = response.getWriter();
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_RENDER_TEST);
    // Run test
    Bridge bridge = getFacesBridge(request, response);
    bridge.destroy();
    try {
        bridge.doFacesRequest(request, response);
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(render) when passed a destroyed bridge. Instead the request completed without an exception.");
    } catch (BridgeUninitializedException bue) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail("Correctly threw BridgeUninitializedException from doFacesRequest(render) when passed a destroyed bridge.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(render) when passed a destroyed bridge. Instead it threw: " + e.toString());
    }
    responsePrintWriter.println(resultWriter.toString());
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) Bridge(javax.portlet.faces.Bridge) IOException(java.io.IOException) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) PortletException(javax.portlet.PortletException) PrintWriter(java.io.PrintWriter)

Example 8 with BridgeUninitializedException

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

the class BridgeDestroyTestPortlet method runEventDestroyTest.

private void runEventDestroyTest(EventRequest request, EventResponse response) throws PortletException, IOException {
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_EVENT_TEST);
    // Run test
    Bridge bridge = getFacesBridge(request, response);
    bridge.destroy();
    try {
        bridge.doFacesRequest(request, response);
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(event) when passed a destroyed bridge. Instead the request completed without an exception.");
    } catch (BridgeUninitializedException bue) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail("Correctly threw BridgeUninitializedException from doFacesRequest(event) when passed a destroyed bridge.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(event) when passed a destroyed bridge. Instead it threw: " + e.toString());
    }
    mActionResult = resultWriter.toString();
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) Bridge(javax.portlet.faces.Bridge) IOException(java.io.IOException) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) PortletException(javax.portlet.PortletException)

Example 9 with BridgeUninitializedException

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

the class BridgeDestroyTestPortlet method runResourceDestroyTest.

private void runResourceDestroyTest(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
    BridgeTCKResultWriter resultWriter = new BridgeTCKResultWriter(DESTROY_RESOURCE_TEST);
    // Run test
    Bridge bridge = getFacesBridge(request, response);
    bridge.destroy();
    try {
        bridge.doFacesRequest(request, response);
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(resource) when passed a destroyed bridge. Instead the request completed without an exception.");
    } catch (BridgeUninitializedException bue) {
        resultWriter.setStatus(BridgeTCKResultWriter.PASS);
        resultWriter.setDetail("Correctly threw BridgeUninitializedException from doFacesRequest(resource) when passed a destroyed bridge.");
    } catch (Exception e) {
        resultWriter.setStatus(BridgeTCKResultWriter.FAIL);
        resultWriter.setDetail("Didn't throw the BridgeUninitializedException from doFacesRequest(resource) when passed a destroyed bridge. Instead it threw: " + e.toString());
    }
    mActionResult = resultWriter.toString();
}
Also used : BridgeTCKResultWriter(com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) Bridge(javax.portlet.faces.Bridge) IOException(java.io.IOException) BridgeUninitializedException(javax.portlet.faces.BridgeUninitializedException) PortletException(javax.portlet.PortletException)

Aggregations

BridgeUninitializedException (javax.portlet.faces.BridgeUninitializedException)9 PortletConfig (javax.portlet.PortletConfig)5 BridgeConfig (javax.portlet.faces.BridgeConfig)5 BridgeTCKResultWriter (com.liferay.faces.bridge.tck.common.util.BridgeTCKResultWriter)4 IOException (java.io.IOException)4 PortletException (javax.portlet.PortletException)4 Bridge (javax.portlet.faces.Bridge)4 BridgeNotAFacesRequestException (javax.portlet.faces.BridgeNotAFacesRequestException)3 PrintWriter (java.io.PrintWriter)1