spring-projects / spring-webflow

Spring Web Flow
https://spring.io/projects/spring-webflow
Apache License 2.0
331 stars 233 forks source link

Using Primefaces Dialog Framework in a flow [SWF-1704] #880

Open spring-operator opened 7 years ago

spring-operator commented 7 years ago

Omid P opened SWF-1704 and commented

due to FlowViewHandler, it is not possible to use Primefaces Dialog framework in spring webflow. I've tested it in primefaces-showcase


Affects: 2.4.4

1 votes, 3 watchers

spring-operator commented 7 years ago

Rossen Stoyanchev commented

Can you clarify what you mean by "due to FlowViewHandler"? In other words do you know the cause or have a fix in mind?

spring-operator commented 7 years ago

Omid P commented

I guess, I know the cause but I don't know how to fix it. AFAIC, since flowViewHandler is responsible for handling navigation in Spring web flow, it prevents from executing org.primefaces.application.DialogNavigationHandler and org.primefaces.application.DialogViewHandler, in other words SWF does not understand JSF ConfigurableNavigationHandler and ignore faces-config navigation-handler.

technically speaking,

FlowViewHandler.java

public String getActionURL(FacesContext context, String viewId) {
        if (JsfUtils.isFlowRequest()) {
            return RequestContextHolder.getRequestContext().getFlowExecutionUrl();
        } else {
            return super.getActionURL(context, viewId);
        }
    }

should be

public String getActionURL(FacesContext context, String viewId) {
        if (JsfUtils.isFlowRequest()) {
                        if (is primefaces dialog request)
                                 org.primefaces.application.DialogViewHandler.getActionURL();
                        else
                        return RequestContextHolder.getRequestContext().getFlowExecutionUrl();
        } else {
            return super.getActionURL(context, viewId);
        }
    }
spring-operator commented 7 years ago

Rossen Stoyanchev commented

in other words SWF does not understand JSF ConfigurableNavigationHandler

Is there a way to use JSF ConfigurableNavigationHandler rather than hard-coding a library specific API, which we'd have to invoke through reflection. Also the flowExecuectionUrl is quite specific to Web Flow (the flow URL with an execution id). I don't know what the DialogViewHandler's actionUrl looks like relative to that.

Do you have a sample app somewhere to experiment with?

spring-operator commented 7 years ago

Omid P commented

I created a sample app https://github.com/omidp/swf-prime-bug where you can expriment on.