Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: AbstractXsltView getting params from http

  1. #1
    Join Date
    Jul 2006
    Location
    London
    Posts
    500

    Default AbstractXsltView getting params from http

    Getting an request parameter via AbstractXsltView.getParameters(HttpServletRequest) is always null.

    eg url.
    data-maintenance.htm?_flowId=create-user&_type=User

    Is anyone else having problems like this?

    Spring 1.2.7, SWF1.0

  2. #2
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    Could you provide a bit more info on your situation:
    Are you triggering the XSLT view in a normal view state?
    Are you using alwaysRedirectOnPause?
    What exactly are you trying to do?
    ...

    Erwin

  3. #3
    Join Date
    Jul 2006
    Location
    London
    Posts
    500

    Default

    Hi Erwin,

    Are you triggering the XSLT view in a normal view state?
    Yes.

    Are you using alwaysRedirectOnPause?
    No

    What exactly are you trying to do?
    I am trying to get the request parameters from the URL which is modelled below:

    The code defines a submenu action named 'Users', which has a URL command that declares the flow id and some additional variables '_rc' and '_search'.

    Code:
    <Action name="showUsersCategory">
     <Property name="display">Users</Property>
     <Property name="command">data-maintenance.htm?_flowId=view-report&amp;_rc=Users&amp;_search=no</Property>
    </Action>
    The req parametes are in the 'context.getRequestParameters().toString()' map when I enter the flow (setupForm) and after I exit doPostExecute, but they are lost when in my View extending AbstractXsltView:

    At this point I only have the FlowExecutionKey.

    Code:
    protected Map getParameters(HttpServletRequest request) {
    		Map params = super.getParameters(request);
    		
    		System.out.println("req params: " + request.getParameterMap().toString());
    This previously worked in RC3..unfortunately the codebase isn't full of junit tests so without rolling back I cannot be sure of which version upgrade (either RC4 or 1.0) may of broke this functionality.

    James
    Last edited by jamesclinton; Nov 14th, 2006 at 04:12 AM.

  4. #4
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    My guess is that you are using "alwaysRedirectOnPause". It is the default in SWF 1.0 so unless you explicitly set it to false you'll be getting POST-REDIRECT-GET behaviour.

    This explains the behaviour you see: During the first POST request you have the request parameters you want. The view state will not directly render the view, instead it will issue a redirect which will cause a second GET request that refreshes the flow execution. This GET refreshes the flow and renders the view. It also only has a single request parameter: the flow execution key.

    To turn off alwaysRedirectOnPause, specify it in your FlowExecutor config:

    Code:
    <flow:executor id="flowExecutor" registry-ref="flowRegistry">
       <flow:execution-attributes>
          <flow:alwaysRedirectOnPause value="false"/>
       </flow:execution-attributes>
    </flow:executor>
    Erwin

  5. #5
    Join Date
    Jul 2006
    Location
    London
    Posts
    500

    Default

    Erwin

    Currently I'm still on Spring 1.2.7 for the next few weeks..could you kindly share the configuration based on DOCTYPE not XSD.

    Code:
    	<!-- Launches new flow executions and resumes existing executions Spring 1.2 configuration-->	
    	<bean id="flowExecutor" class="org.springframework.webflow.config.FlowExecutorFactoryBean">
    		<property name="definitionLocator" ref="flowRegistry"/>
    		<property name="alwaysRedirectOnPause" value="false"/> ???
    	</bean>
    
    	<!-- Creates the registry of flow definitions for this application Spring 1.2 configuration -->
    	<bean id="flowRegistry" class="org.springframework.webflow.engine.builder.xml.XmlFlowRegistryFactoryBean">
    		<property name="flowLocations" value="/WEB-INF/flow/*.xml"/>
    	</bean>
    Thank you.

  6. #6
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    Here it is:

    Code:
    <bean id="flowExecutor" class="org.springframework.webflow.config.FlowExecutorFactoryBean">
      <property name="definitionLocator" ref="flowRegistry"/>
      <property name="executionAttributes">
        <map>
          <entry key="alwaysRedirectOnPause" value="false"/>
        </map>
      </property>
    </bean>
    Erwin

  7. #7
    Join Date
    Jul 2006
    Location
    London
    Posts
    500

    Talking Thanks!

    Great. Many thanks Erwin.

  8. #8
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    Or rather, you'll need:

    Code:
    <entry key="alwaysRedirectOnPause">
      <value type="java.lang.Boolean">false</value>
    </entry>
    Since it needs to be a boolean.

    Erwin

  9. #9
    Join Date
    Jul 2006
    Location
    London
    Posts
    500

    Default Error.

    Erwin

    Unfortunately this configuration throws an exception:

    Code:
    IllegalArgumentException: Map key 'alwaysRedirectOnPause' has value [false] that is not of expected type [class java.lang.Boolean], instead it is of type [java.lang.String]
    James

  10. #10
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    Check my previous post

    This will be improved in SWF 1.0.1, where it will also accept the String values "true" or "false".

    Erwin
    Last edited by klr8; Nov 14th, 2006 at 06:36 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •