Search in sources :

Example 1 with ActionParameters

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

the class ActionURLDemoPortlet method processAction.

@Override
public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException {
    ActionParameters actionParameters = actionRequest.getActionParameters();
    String viewState = null;
    for (String actionParameterName : actionParameters.getNames()) {
        // necessary to iterate through the action parameter names in order to find the view state parameter.
        if (actionParameterName.contains(ResponseStateManager.VIEW_STATE_PARAM)) {
            viewState = actionParameters.getValue(actionParameterName);
            break;
        }
    }
    String nonFacesPostback = actionParameters.getValue("Non-Faces-Postback");
    if ((viewState == null) && ("true".equalsIgnoreCase(nonFacesPostback))) {
        MutableRenderParameters mutableRenderParameters = actionResponse.getRenderParameters();
        mutableRenderParameters.setValue("Non-Faces-Postback", nonFacesPostback);
        String foo = actionParameters.getValue("foo");
        if (foo != null) {
            mutableRenderParameters.setValue("foo", foo);
        }
    } else {
        super.processAction(actionRequest, actionResponse);
    }
}
Also used : ActionParameters(javax.portlet.ActionParameters) MutableRenderParameters(javax.portlet.MutableRenderParameters)

Aggregations

ActionParameters (javax.portlet.ActionParameters)1 MutableRenderParameters (javax.portlet.MutableRenderParameters)1