final ExternalContext externalContext = facesContext.getExternalContext();
final Object response = externalContext.getResponse();
final Application application = facesContext.getApplication();
final ViewHandler viewHandler = application.getViewHandler();
final String viewId = facesContext.getViewRoot().getViewId();
final String formAction = externalContext.encodeActionURL(viewHandler.getActionURL(facesContext, viewId));
final String partialAction;
final boolean portlet = PortletUtils.isPortletApiAvailable() && response instanceof MimeResponse;
if (portlet) {
final MimeResponse mimeResponse = (MimeResponse) response;
final ResourceURL resourceURL = mimeResponse.createResourceURL();