Hi there,
I'm developing a simple portlet using the sample application to start but I don't manage to switch the portlet mode using the icon displayed by jetspeed.
My conf:
portlet.xml
mvc + wf config:Code:<?xml version="1.0" encoding="ISO-8859-1"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"> <portlet> <portlet-name>swf-booking-mvc</portlet-name> <display-name>Spring Webflow Booking MVC</display-name> <portlet-class> org.springframework.web.portlet.DispatcherPortlet </portlet-class> <init-param> <name>contextConfigLocation</name> <value> /WEB-INF/config/hotelbooking-portlet-config.xml </value> </init-param> <init-param> <name>viewRendererUrl</name> <value>/WEB-INF/servlet/view</value> </init-param> <expiration-cache>0</expiration-cache> <supports> <mime-type>text/html</mime-type> <portlet-mode>view</portlet-mode> <portlet-mode>edit</portlet-mode> </supports> <portlet-info> <title>Spring Webflow Booking MVC</title> </portlet-info> </portlet> </portlet-app>
ViewFlowHandler.javaCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:webflow="http://www.springframework.org/schema/webflow-config" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd"> <!-- Maps portlet modes to handlers --> <bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping"> <property name="portletModeMap"> <map> <entry key="view"> <bean class="org.springframework.webflow.samples.booking.ViewFlowHandler"/> </entry> <entry key="edit"> <bean class="org.springframework.webflow.samples.booking.edit.EditFlowHandler"/> </entry> </map> </property> </bean> <!-- Maps logical view names selected by the url filename controller to .jsp view templates within the /WEB-INF directory --> <bean id="internalJspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/" /> <property name="suffix" value=".jsp" /> </bean> <!-- Enables FlowHandlers --> <bean class="org.springframework.webflow.mvc.portlet.FlowHandlerAdapter"> <property name="flowExecutor" ref="flowExecutor"/> </bean> <!-- Executes flows: the central entry point into the Spring Web Flow system --> <webflow:flow-executor id="flowExecutor"> <webflow:flow-execution-listeners> <webflow:listener ref="jpaFlowExecutionListener" /> </webflow:flow-execution-listeners> </webflow:flow-executor> <!-- The registry of executable flow definitions --> <webflow:flow-registry id="flowRegistry"> <webflow:flow-location path="/WEB-INF/flows/edit/edit.xml" /> <webflow:flow-location path="/WEB-INF/flows/view/view.xml" /> </webflow:flow-registry> <!-- Installs a listener that manages JPA persistence contexts for flows that require them --> <bean id="jpaFlowExecutionListener" class="org.springframework.webflow.persistence.JpaFlowExecutionListener"> <constructor-arg ref="entityManagerFactory" /> <constructor-arg ref="transactionManager" /> </bean> </beans>
EditFlowHandler.javaCode:package org.springframework.webflow.samples.booking; import org.apache.log4j.Logger; import org.springframework.webflow.mvc.portlet.AbstractFlowHandler; public class ViewFlowHandler extends AbstractFlowHandler { private Logger logger = Logger.getLogger(this.getClass()); public String getFlowId() { return "view"; } }
As you see there are two flowhandlers mapped to each mode, however in the trace I get when I click the edit icon I see:Code:package org.springframework.webflow.samples.booking.edit; import org.apache.log4j.Logger; import org.springframework.webflow.mvc.portlet.AbstractFlowHandler; public class EditFlowHandler extends AbstractFlowHandler { private Logger logger = Logger.getLogger(this.getClass()); public String getFlowId() { return "edit"; } }
log:
... As appears right above, although it receives the key "edit" mapped to the EditFlowHandler it finally gets the FlowDefinition with id "view"... ???????Code:2009-03-24 16:05:21 [DEBUG] [org.springframework.web.portlet.handler.AbstractMapBasedHandlerMapping.getHandlerInternal(AbstractMapBasedHandlerMapping.java:70)] Key [edit] -> handler [org.springframework.webflow.samples.booking.edit.EditFlowHandler@1646de5] 2009-03-24 16:05:21 [DEBUG] [org.springframework.web.portlet.DispatcherPortlet.getHandlerAdapter(DispatcherPortlet.java:965)] Testing handler adapter [org.springframework.webflow.mvc.portlet.FlowHandlerAdapter@d22860] 2009-03-24 16:05:21 [DEBUG] [org.springframework.webflow.conversation.impl.ContainedConversation.lock(ContainedConversation.java:67)] Locking conversation 2 2009-03-24 16:05:21 [DEBUG] [org.springframework.webflow.execution.repository.impl.DefaultFlowExecutionRepository.getFlowExecution(DefaultFlowExecutionRepository.java:95)] Getting flow execution with key 'e2s1' 2009-03-24 16:05:21 [DEBUG] [org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl.getFlowDefinition(FlowDefinitionRegistryImpl.java:58)] Getting FlowDefinition with id 'view'
Any idea of what's wrong?
Thanks!


Reply With Quote