标签: spring-webflow

Spring Web Flow - 如何使用conversationScope中已有的值设置单元测试?

我正在使用Spring Web Flow 2.0开发一个项目.

我试图对以决策状态开始的流进行单元测试.决策状态检查对象上的对象的值conversationScope.我无法弄清楚如何conversationScope在单元测试中插入一个值.

我试过了:

getConversationScope().put("someName", value);
MockExternalContext context = new MockExternalContext();
startFlow(context);
Run Code Online (Sandbox Code Playgroud)

但是,似乎当我调用startFlow(context)该值时会被清除.

我也尝试过:

MockExternalContext context = new MockExternalContext();
setCurrentState("someDecisionState");
resumeFlow(context)
Run Code Online (Sandbox Code Playgroud)

但是测试失败并且错误地告诉我,我无法从决策状态恢复,只能从视图状态恢复.

有谁知道如何插入模拟值,conversationScope以便我可以测试这些情况?

java spring-webflow spring-webflow-2

4
推荐指数
1
解决办法
4029
查看次数

spring webflow:根据某些输入重定向到end-state

我在流程中有一些输入,即

<input name="someInput" type="long" required="true"/>
Run Code Online (Sandbox Code Playgroud)

我想将最终状态重定向到依赖于此输入的位置.我正在尝试以下方法:

<end-state id="done" view="externalRedirect:contextRelative:/blahblah/${someInput}"/>
Run Code Online (Sandbox Code Playgroud)

这不起作用(webflow不会将$ {someInput}替换为其值(它将此视为标准字符串.您知道如何正确执行此操作吗?

spring-webflow

4
推荐指数
1
解决办法
6728
查看次数

如何调试不执行任何操作且不引发异常的 Spring Webflow 提交

我有 spring 2.5 应用程序,流程中的几个页面工作得很好 - 它们根据我的 flow.xml 进行。“损坏”的页面具有以下形式的提交:

<input type="image" name="_eventId_submit" src="<c:url value="images/continue.png" />" />
Run Code Online (Sandbox Code Playgroud)

此页面的流程定义看起来正确:

<view-state id="coverages" view="tiles.coverages" model="rtrForm">
    <on-entry>
 ...
    </on-entry>
    <transition on="submit" to="policyVehicleDetailsDecisionForward">
        <evaluate expression="coverageFormAction.bindAndValidate" />
        <evaluate expression="coverageFormAction.evaluateCoverages(rtrForm)" />
    </transition>
</view-state>
Run Code Online (Sandbox Code Playgroud)

我在 mainFlowAction.evaluateCoverages(...) 中有调试语句,我在日志文件中没有看到这一点,但我也没有看到任何异常 - 有人知道从这里去哪里吗?我已将 Eclipse 附加到 Tomcat 6.0.33 进行远程调试,但我仍然没有看到任何异常......这一点我很困惑,不知道如何解决这个问题 - 任何帮助或欢迎提出建议。

因此,我又采取了几个步骤,并重写了 QuoteFormAction.bindAndValidate() 方法,遗憾的是,我没有看到在日志中调用此方法 - 所以我此时假设该表单是甚至没有调用它......我对所有有效的页面使用相同的模式。我已经缩写了表格 - 也许我忽略了一些明显的事情:

<form id="rtrForm" action="/rtrSite/main.svc?execution=e1s5" method="post">
...
<select name="quoteForm.policyLevelCoverages.towing" class="violationType" id="TOWING"  validate="selectOneOption" req="">
...
<select name="quoteForm.vehicleLevelCoverages[0].rental" class="violationType" id="RENTAL"  validate="selectOneOption" req="">
...
<input type="image" name="_eventId_submit" src="images/continue.png" />
<input type="image" name="_eventId_save" …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc spring-webflow

4
推荐指数
1
解决办法
7757
查看次数

什么是在部署中设置Cache-Control no-cache,no-store?

我有一个问题,我的应用程序部署总是返回响应标头:

Cache-Control: no-cache
Cache-Control: no-store
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:no-cache
Run Code Online (Sandbox Code Playgroud)



我正在使用:

春季3.1.2.RELEASE

Primefaces JSF 3.4.1

Spring Webflow 2.3.0.RELEASE

JBoss AS 7.0.1



我已经尝试了几乎我可以找到的应用程序方面的所有解决方案:

  1. 配置WebContentInterceptor(尝试了它的各种排列)开箱即用的缓存控制头过滤器?
  2. 编写自定义拦截器,添加不同的Cache-Control标头(使用Cache-Control:private测试)
  3. 编写添加HTTP响应参数的客户过滤器.使用Cache-Control配置它:private作为web.xml中的init-params
  4. 使用context.xml文件(在META-INF /和WEB-INF /中都尝试过)来禁用JBoss/Tomcat中的Cache-Control http://daveharris.wordpress.com/2007/07/09/how-to-配置高速缓存控制功能于tomcat的/

在所有上述情况中,响应头从未结束不同,总是没有缓存,没有存储,1970年到期,pragma:no-cache

我的想法已经不多了,有人知道在我的响应中设置这些标头是什么,所以我可以定位适当的部署组件来解决这个问题吗?

java jboss spring spring-webflow primefaces

4
推荐指数
1
解决办法
7943
查看次数

Web流例外:找不到ID为'1'的流执行快照

每当我在web-flow中将一个状态切换到另一个状态超过15次时,我就会遇到异常.

No flow execution snapshot could be found with id '1'; perhaps the snapshot has been removed? . Stacktrace follows:
org.springframework.webflow.execution.repository.FlowExecutionRestorationFailureException: A problem occurred restoring the flow execution with key 'e7s1'
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException: No flow execution snapshot could be found with id '1'; perhaps the snapshot has been removed? 
... 3 more
Run Code Online (Sandbox Code Playgroud)

我正在使用grails webflow插件.

有谁知道为什么会发生这种情况以及如何解决这个问题?

grails spring spring-webflow

4
推荐指数
2
解决办法
6150
查看次数

如何在Grails webflow中测试flash.message?

我在Grails中使用webflow,我正在为它编写测试.现在,在内部我有一些错误,所以我在重定向之前向flash范围设置了一条消息:

...
if (some_condition) {
   flash.message = "my error message"
   return error()
}
...
Run Code Online (Sandbox Code Playgroud)

现在,我知道当我要在GSP页面中显示它时,我将访问flash消息

<g:if test="${message}">...
Run Code Online (Sandbox Code Playgroud)

而不是通常的

<g:if test="${flash.message}">...
Run Code Online (Sandbox Code Playgroud)

所以无论如何,我正在编写我的测试,我想知道如何测试消息的内容?通常,在控制器的正常操作中,我遵循这里所写的内容.但是,由于这是一个webflow,即使我检查controller.flash.message/controller.params.message/controller.message,我似乎也找不到该消息.我也试过看流量范围......

有关如何查看消息的任何想法吗?谢谢你!

testing grails spring-webflow

3
推荐指数
1
解决办法
2950
查看次数

javax.faces.context.FacesContext.isReleased(FacesContext.java:609)中的java.lang.UnsupportedOperationException

我正在集成SWF 2.2.1,Primefaces 2.2.1,JSF 2,Spring Security 3,Spring 3.1.0M1.我能够点击Spring web-flow xml中提到的第一页,但是出现了以下错误.

com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
SEVERE: Error Rendering View[/WEB-INF/flows/AccSrch/searchAccIns.xhtml]
java.lang.UnsupportedOperationException
at javax.faces.context.FacesContext.isReleased(FacesContext.java:609)
at com.sun.faces.context.PartialViewContextImpl.updateFacesContext(PartialViewContextImpl.java:468)
at com.sun.faces.context.PartialViewContextImpl.isAjaxRequest(PartialViewContextImpl.java:108)
at javax.faces.context.PartialViewContextWrapper.isAjaxRequest(PartialViewContextWrapper.java:117)
at javax.faces.component.UIViewRoot.getRendersChildren(UIViewRoot.java:1020)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1755)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at org.springframework.faces.webflow.FlowLifecycle.render(FlowLifecycle.java:80)
at org.springframework.faces.webflow.JsfView.render(JsfView.java:90)
Run Code Online (Sandbox Code Playgroud)

令我惊讶的是,我的.xhtml中只有最少的代码

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:p="http://primefaces.prime.com.tr/ui">
   <ui:define name="content">
      <f:view>
         <h:form id="expire" prependId="false">
            <h:outputText value="HEllo" />
         </h:form>
      </f:view>
   </ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)

请参阅此帖子以获取上下文 链接

java jsf spring spring-webflow jsf-2

3
推荐指数
1
解决办法
5349
查看次数

创建名称为bean的bean时出错:Scope'request'对当前线程无效

我集成了SWF 2.2.1,Primefaces 2.2.1,JSF 2,Spring Security 3,Spring 3.1.0M1I和EhCache以及AspectJ和Castor.

我在app-config.xml中为castor定义了bean

<bean id="oXMapper" class="com.abc.xyz.util.OXMapper">
    <property name="unmarshaller" ref="unmarshaller" />
    <property name="marshaller" ref="marshaller" />
    <property name="acordRequest" ref="acordRequest" />
    <property name="acordResponse" ref="acordResponse" />
</bean>

<bean id="unmarshaller" class="org.springframework.oxm.castor.CastorMarshaller">
    <property name="mappingLocation"
        value="classpath:/templates/mapping/ACORD_Response_Mapping.xml" />
</bean>

<bean id="marshaller" class="org.springframework.oxm.castor.CastorMarshaller">
    <property name="mappingLocation"
        value="classpath:/templates/mapping/ACORD_Request_Mapping.xml" />
</bean>

<bean id="acordRequest" class="com.abc.xyz.cate.domain.ACORD">
    <property name="insuranceSvcRq" ref="insuranceSvcRq" />
    <property name="signonRq" ref="CltSearch_signonRq" />
</bean>
Run Code Online (Sandbox Code Playgroud)

我有一个搜索页面,我在这里建立参数,如

<h:panelGrid>
    <h:selectOneRadio id="#{msg.srchType}" value="#{acordRequest.insuranceSvcRq.com_csc_ClientSearchRq.com_csc_SearchInfo.com_csc_SearchCriteria.com_csc_ClientSearch.com_csc_SearchNameByType}">
        <f:selectItem itemLabel="#{msg.exact}" itemValue="E" id="#{msg.exact}" />
    <f:selectItem itemLabel="#{msg.phonetic}" itemValue="S" id="#{msg.phonetic}" />
    <f:selectItem itemLabel="#{msg.truncated}" itemValue="P" id="#{msg.truncated}" />
        </h:selectOneRadio>
</h:panelGrid>
Run Code Online (Sandbox Code Playgroud)

使用Spring Webflow,我调用OXMapper函数并将ACORD(用于构建xml的分层结构)对象传递给它.此OXMapper类分别负责对象和xml的编组和解组. …

spring aspectj castor spring-webflow

3
推荐指数
1
解决办法
1万
查看次数

Spring webflow - 如何在evaluate表达式中传递会话?

我正在使用spring webflow,但是我需要在一个使用transition ==> evaluate表达式访问的方法中访问我的HttpSession.(所以在包含我的流的xml文件中)到目前为止,我还没有找到一种方法将它实际传递给我的方法.我已经看了一下flowrequestcontext,但到目前为止我还没有找到方法.

spring-webflow spring-webflow-2

3
推荐指数
2
解决办法
1万
查看次数

Spring webflow PropertyNotFoundException:找不到属性

我试图在spring webflow xml定义中设置会话范围内的变量,并且找不到找到的属性.请帮助

118484 [http-8080-6] DEBUG servlet.YBRServlet - 处理程序执行导致异常 - 转发到已解析的错误视图:ModelAndView:引用名为'Err010DfltCrtc'的视图; model是{exception = org.springframework.webflow.execution.ActionExecutionException:异常抛出执行[AnnotatedAction @ 87ba9e targetAction = [SetAction @ 1ed364c name = flowRequestContext.externalContext.sessionMap.testCompleted,value = yes],attributes = map [[empty]在流'QlfyEnrl'的状态'AnnIncr'中 - 动作执行属性是'map [[empty]]'} org.springframework.webflow.execution.ActionExecutionException:抛出执行异常[AnnotatedAction @ 87ba9e targetAction = [SetAction @ 1ed364c]流'QlfyEnrl'的状态'AnnIncr'中的name = flowRequestContext.externalContext.sessionMap.testCompleted,value = yes],attributes = map [[empty]]] - 动作执行属性是org的'map [[empty]]'位于org.springframework.webflow.engine.State.enter(状态)的org.springframework.webflow.engine.ActionList.execute(ActionList.java:155)上的.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:60) .java:193)在org.springframework.webflow.engine.Transition.exec ute(Transition.java:227)at org.springframework.webflow.engine.DecisionState.doEnter(DecisionState.java:51)引起:org.springframework.binding.expression.PropertyNotFoundException:在org.springframework.binding中找不到属性. expression.spel.SpringELExpression.getValue(SpringELExpression.java:87)at

org.springframework.expression.spel.SpelEvaluationException:EL1008E*:( pos 0):在org.springframework 上的*type'org'springframework.webflow.engine.impl.RequestControlContextImpl '的对象上找不到字段或属性'yes'.在org.springframework.expression.spel.ast.SpelNodeImpl的org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:60)的expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:180). org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:97)中的getTypedValue(SpelNodeImpl.java:102)org.springframework.binding.expression.spel.SpringELExpression.getValue(SpringELExpression.java:84) ......还有88个

流程代码

<view-state id="AnnIncr" view="AnnIncr" model="ssModel">
<on-entry>

            <set name="flowRequestContext.externalContext.sessionMap.testCompleted" value="yes"></set>
        </on-entry>
.....
    <on-exit>
    <set name="flowRequestContext.externalContext.sessionMap.testCompleted" value="no"></set> …
Run Code Online (Sandbox Code Playgroud)

java spring-webflow

3
推荐指数
1
解决办法
8703
查看次数