Announcement Announcement Module
Collapse
No announcement yet.
Use FlowExecutionListener Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Use FlowExecutionListener

    IŽm new to Spring and I want to get access of httpservletrequest in all my webflow.

    IŽve see an example on the net that did:

    Code:
    public void sessionStarting(final RequestContext context, final State startState, final Map input) {
            copyAttributes(context);
        }
    
        public void requestSubmitted(final RequestContext context) {
            copyAttributes(context);
        }
    
        private void copyAttributes(final RequestContext context) {
            ServletRequest request = ((ServletEvent) context.getSourceEvent()).getRequest();
            for (String name: names) {
                context.getRequestScope().put(name, request.getAttribute(name));
            }
        }
    but I couldŽnt figure out how to add this listener to my webflow.

    Could somebody give an example ?

    Thanks in advance

    C

  • #2
    1. Create a listener class that implements FlowExecutionListener interface or extends the FlowExecutionListenerAdapter class.

    2. Add the listener to your flow execution manager

    Code:
    <bean id="flowExecutionManager" class="org.springframework.webflow.execution.servlet.ServletFlowExecutionManager">
    		<property name="listener">
    			<bean class="my.package.FlowListenerImpl"/>
    		</property>
    	</bean>
    3. Add the flow execution manager to your controller

    Code:
    <bean id="workflowController" name="/*.flow" class="org.springframework.webflow.mvc.FlowController">
    		<property name="flowExecutionManager" ref="flowExecutionManager"/>
    	</bean>

    Comment


    • #3
      Am getting following exception in SWF 1.0.5 version

      HTTP Status 500 -

      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: Servlet.init() for servlet ibe threw exception
      org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
      org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:535)
      org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
      org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
      org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
      org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
      org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
      java.lang.Thread.run(Thread.java:595)

      root cause

      org.springframework.beans.factory.CannotLoadBeanCl assException: Cannot find class [org.springframework.webflow.execution.ServletFlowE xecutionManager] for bean with name 'flowExecutionManager' defined in ServletContext resource [/WEB-INF/ibe-servlet.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.webflow.execution.ServletFlowE xecutionManager
      org.springframework.beans.factory.support.Abstract BeanFactory.resolveBeanClass(AbstractBeanFactory.j ava:915)
      org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanNamesForType(DefaultList ableBeanFactory.java:165)
      org.springframework.context.support.AbstractApplic ationContext.getBeanNamesForType(AbstractApplicati onContext.java:687)
      org.springframework.context.support.AbstractApplic ationContext.invokeBeanFactoryPostProcessors(Abstr actApplicationContext.java:397)
      org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:330)
      org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:156)
      org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:3 08)
      org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:252 )
      org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:221)
      org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:115)
      javax.servlet.GenericServlet.init(GenericServlet.j ava:211)
      org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
      org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:535)
      org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
      org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
      org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
      org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
      org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
      java.lang.Thread.run(Thread.java:595)

      root cause

      java.lang.ClassNotFoundException: org.springframework.webflow.execution.ServletFlowE xecutionManager
      org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1340)
      org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1189)
      org.springframework.util.ClassUtils.forName(ClassU tils.java:177)
      org.springframework.beans.factory.support.Abstract BeanDefinition.resolveBeanClass(AbstractBeanDefini tion.java:313)
      org.springframework.beans.factory.support.Abstract BeanFactory.resolveBeanClass(AbstractBeanFactory.j ava:912)
      org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanNamesForType(DefaultList ableBeanFactory.java:165)
      org.springframework.context.support.AbstractApplic ationContext.getBeanNamesForType(AbstractApplicati onContext.java:687)
      org.springframework.context.support.AbstractApplic ationContext.invokeBeanFactoryPostProcessors(Abstr actApplicationContext.java:397)
      org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:330)
      org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:156)
      org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:3 08)
      org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:252 )
      org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:221)
      org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:115)
      javax.servlet.GenericServlet.init(GenericServlet.j ava:211)
      org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
      org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:535)
      org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
      org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
      org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
      org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
      org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
      java.lang.Thread.run(Thread.java:595)

      note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
      Apache Tomcat/5.0.28

      this is repeating even when am using the suggested class "org.springframework.webflow.execution.servlet.Ser vletFlowExecutionManager"


      Any clue how to get a ServletFlowExecutionManager in SWF 1.0.5
      Last edited by Sudheesh; May 22nd, 2008, 09:23 AM.

      Comment


      • #4
        In the thread http://forum.springframework.org/showthread.php?t=54413 I have posted an example for SWF 2.x

        - Peter

        Comment

        Working...
        X