Announcement Announcement Module
Collapse
No announcement yet.
AbstractXsltView getting params from http Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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, 04:12 AM.

      Comment


      • #4
        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

        Comment


        • #5
          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.

          Comment


          • #6
            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

            Comment


            • #7
              Thanks!

              Great. Many thanks Erwin.

              Comment


              • #8
                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

                Comment


                • #9
                  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

                  Comment


                  • #10
                    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, 06:36 AM.

                    Comment


                    • #11
                      Doh! nice one Erwin.

                      ** must stop developing at 100 miles an hour!

                      Comment

                      Working...
                      X